Re: [R] Referencing a vector of data labels in ggplot function

2011-07-11 Thread Ben Hunter
That did it. I just wanted the line names to be placed at the second to last date tick mark. Later I'll write something that adjusts the labels if there isn't room or if there is overlap. Thanks! On Sat, Jul 9, 2011 at 7:38 AM, Hadley Wickham wrote: > Maybe something like this? > > withNames <-

Re: [R] Referencing a vector of data labels in ggplot function

2011-07-09 Thread Hadley Wickham
Maybe something like this? withNames <- function(dframe, lineNames, plotName, colors){ one_day <- subset(dframe, data == '1941-06-16') one_day$lineNames <- lineNames ggplot(dframe, aes(date, value, group = factor, color = factor)) + geom_line(size = 1) + facet_grid(Facet~., scales =

[R] Referencing a vector of data labels in ggplot function

2011-07-08 Thread Ben Hunter
Hi, I really feel I've looked everywhere, although I know this can't be a hard problem. I'd like to be able to call the graph below as a function, but I can't get the function to recognize variables beyond 'dframe'. I've read through many papers on writing functions in R, but I can't get this to w