Hi all,

For various reasons, I need to use ggplot instead of qplot for a complex
figure. Everything is working fine, except I cannot figure out how to rename
the axis labels in ggplot. I have pasted a simple example below. Any ideas
on what I am doing wrong?

Thanks for your help.

James



library(ggplot2)
##create data
mydat<-data.frame("site"=sample(c(0,1),100,replace=T),"response"=rnorm(100,5,2))
mydat$predictor<-mydat$response*1.5+rnorm(100)

##qplot works fine
qp<-qplot(predictor,response,data=mydat,xlab="Predictor
Variable",ylab="Response Variable")

##However, trying this with ggplot, I cannot change the axis labels
p<-ggplot(data=mydat,aes(shape=factor(site),x=predictor,y=response))
p$xlabel="Predictor Variable"
p$ylabel="Response Variable"
p+geom_point()
-- 
View this message in context: 
http://www.nabble.com/ggplot2%3A-changing-axis-labels-in-ggplot%28%29-tf4801014.html#a13736149
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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.

Reply via email to