[R] ggplot2: changing axis labels in ggplot()

James D Forester jdforest at uchicago.edu
Wed Nov 14 02:23:06 CET 2007



hadley wrote:
> 
> 
> That's from a previous version, now you need to do:
> 
> p + scale_x_continuous("Predictor") + scale_y_continuous("Response")
> 
> (or scale_x_discrete if discrete)
> 
> 

Thanks Hadley -- that worked fine. However, I just noticed that when I try
to add an abline to this plot a strange error appears. First, I update the
abline function based on your advice 
http://www.nabble.com/ggplot2-geom_abline-slope-not-working--tf4770727.html#a13646422
here .

Then I try to add a line to the example I used above:

p<-ggplot(data=mydat,aes(shape=factor(site),x=predictor,y=response))

p+geom_point()+
  scale_x_continuous("Predictor Variable")+
  scale_y_continuous("Response Variable") +
  geom_abline(slope=0,intercept=5)


The error I get is:

Error in typeof(x) : object "site" not found


Is this a bug or a syntax error?
-- 
View this message in context: http://www.nabble.com/ggplot2%3A-changing-axis-labels-in-ggplot%28%29-tf4801014.html#a13738293
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list