[R] ggplot2 legend text....a basic question

Charlotte Wickham cwickham at gmail.com
Mon Sep 14 20:20:39 CEST 2009


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




More information about the R-help mailing list