Displaying 3 results from an estimated 3 matches for "namposts".
2009 Oct 17
2
Putting names on a ggplot
...===========
year[,5] <- 1:length(year[,1])
names(year) <- c('month','days','year','temps', "duration")
month.days <- as.vector(table(year[,1]))
months <- rep(month.name[1:12], month.days)
month.counts <- cumsum(as.vector( table(year[,1])))
namposts <- c(1, month.counts[1:11])
mlabs <- month.name[1:12]
temprange <- range(year$temps, na.rm=TRUE)
p <- ggplot(year, aes(duration, temps, colour=months)) + geom_line() +
opts(legend.position = "none", title="Yearly temperatures",
axis.text.x = theme_bla...
2009 Oct 09
1
Placing text in a ggplot
...r graph to work yesterday the day before yesterday with Baptise A's help. Can anyone suggest what I am doing wrong. Data set is below code.
Thanks.
Code
=========================================================================
line.count <- c(1,cumsum(as.vector((table(year$monthnum)))))
namposts <- line.count[1:12]
temprange <- range(year[,4], na.rm=TRUE)
mlabs <- month.name[1:12]
p <- ggplot(year, aes(duration, temps, colour=month)) + geom_line() +
ylab("Temperature (C)") + xlab("Mean Daily Temperatures") +
opts(legend.position = "none...
2010 Feb 28
1
ggplot 'annotate problem' again.
...(smu) provided a solution using annotate(). However I apparently did not update the graph file and,now, when I go back to the thread and try to use Stefan's solution it does not seem to work although I am sure that it did then.
The problem arises at:
> p + annotate("text", x=namposts+2.5, y = temprange[2], label= mlabs, size=2.5, colour='black', hjust = 0, vjust = 0)
Error: When _setting_ aesthetics, they may only take one value. Problems: label
I want the names of the months along the top of the graph (one month per division).It appears that I am being told that th...