Greg
unread,Feb 28, 2012, 10:57:55 AM2/28/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ggplot2
Hi, I am not sure whether my subject make sense but here is something
I find pretty confusing about ggplot2. Why are the default options
changed for certain elements when I change other related options? The
best way to clarify what I mean is an example. Why does the color of
the legend key rect border and fill change when I just want to change
the size of the legend key rect? This problem (or is it a feature)
occurs all the time. I think ggplot2 should only change the option I
actually want to change. Otherwise, I end up trying to figure out what
the default colors are so that I can only change the option I want.
Thanks,
Greg
ps: sorry if this is discussed elsewhere. I just didn't know what to
search for...
require(ggplot2)
# simulate data
x=rnorm(100)
y=rnorm(100)
k=factor(rbinom(100,1,0.5))
# plot
g =ggplot(data.frame(x,y,k),aes(x=x,y=y,color=k)) + geom_point()
g
# now I want to change the size of the legend key border
g + opts(legend.key=theme_rect(size=0.2))
# AND the color of the legend key border and fill changes too...