Hello R-List I've run into a minor problem with ggplot2. In particular, I get an error message when trying to plot a horizonal line through zero. Here is what I do:
plt.df <- subset(xfm.df, select=c(stage, subj, tX)) plt <- ggplot(pp.df, aes(x=stage, y=tX, group=subj)) + geom_line() plt plt <- plt + geom_hline(intercept=0) plt The first plot yields a most lovely graph. Addition of the geom_hline yields ... "Error in eval(expr, envir, enclos) : object "subj" not found" The data.frame that I'm plotting looks like this ... > str(plt.df) 'data.frame': 468 obs. of 3 variables: $ stage: Factor w/ 12 levels "f1","f2","f3",..: 1 1 1 1 1 1 1 1 1 1 ... $ subj : Factor w/ 39 levels "1","2","3","4",..: 1 2 3 4 5 6 7 8 9 10 ... $ tX : num -0.00011 -0.44548 -0.39649 -0.19610 -0.46434 ... I suspect that I'm likely doing something obviously wrong, but I can't figure out what it might be. Any suggestions? On an unrelated note, does anyone know how I might change the default axis names in ggplot? I suspect it's aes-related, but not quite sure. Thanks, -Jim -- ================================= Jim Nikelski, Ph.D. Postdoctoral Research Fellow Bloomfield Centre for Research in Aging Lady Davis Institute for Medical Research Sir Mortimer B. Davis - Jewish General Hospital McGill University ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.