Hello fellow R's, I?ve been learning to use the ggplot2 library, and after a full day of work I still have a couple of basic questions. Here is an example: mydata=data.frame(x=runif(20),y=runif(20),n=runif(20)) mydata2=data.frame(x=c(0.4,0.6,0.5),y=c(0.4,0.4,0.6)) ggplot(mydata, aes(x, y)) + geom_point(aes(size = n)) + geom_polygon(data=mydata2,aes(x,y,alpha=0.5)) In this plot, the points are labeled as "n" (the name of the variable) and the polygon is labeled as "0.5" (the alpha value used). My questions are: a) How to change the text in the legend (for example, "number" instead of "n"). b) How to avoid having a legend for the polygon? Many thanks, Julian -- Julian Mariano Burgos Hafranns?knastofnunin/Marine Research Institute Sk?lagata 4, 121 Reykjav?k, Iceland S?mi/Telephone : +354-5752037 Br?fs?mi/Telefax: +354-5752001 Netfang/Email: julian at hafro.is, jmburgos at u.washington.edu
> a) How to change the text ?in the legend (for example, "number" instead of > "n").Use: scale_size("number")> b) How to avoid having a ?legend for the polygon?Don't include the value for alpha inside aes (you want to set it as opposed to mapping it). So, ggplot(mydata, aes(x, y)) + geom_point(aes(size = n)) + geom_polygon(data=mydata2,aes(x,y),alpha = 0.5) + scale_size("number") should be what you want. Charlotte> Many thanks, > > Julian > > -- > Julian Mariano Burgos > Hafranns?knastofnunin/Marine Research Institute > Sk?lagata 4, 121 Reykjav?k, Iceland > S?mi/Telephone : +354-5752037 > Br?fs?mi/Telefax: ?+354-5752001 > Netfang/Email: julian at hafro.is, jmburgos at u.washington.edu > > ______________________________________________ > R-help at 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. >