Displaying 1 result from an estimated 1 matches for "getplot".
Did you mean:
setplot
2008 Feb 15
1
ggplot2 used in a function - variable scope/environment
...in the function, the variable *name* is stored in the layer,
rather than the variable's *value* - so that after the function returns
the ggplot2-object, it doesn't plot because the variable don't exist in
the environment calling the function.. e.g:
my function does something like:
getPlot<-function(da=NULL,...){
#1st column holds x-values, others hold data series to plot...
co<-as.character(names(da))
co<-co[2:length(co)]
pl<-ggplot(data=da)
pl<-pl+scale_y_log10()+scale_x_continuous()
for(c in co){
pl<-pl+geom_line(x=da[[1]],y=da[[c]],mapping=aes(x=da[[1]...