On 10/14/07, Jim Nikelski <[EMAIL PROTECTED]> wrote: > 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"
Can you try the following? plt + geom_hline(aes(group=1), intercept = 0) If that works, I'll fix it in the development version. > 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. The axis label is a property of the scale, so you set it by overriding the default scale: plot + scale_y_continuous("New y axis label") Hadley -- http://had.co.nz/ ______________________________________________ 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.