Scott
unread,Sep 17, 2011, 8:18:23 AM9/17/11Sign 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
I couldn't find where else to submit this, but I just wanted to write
this as a quick FYI that might save some one some time in the future.
I was struggling with two legends (one for shape, one for color) that
wouldn't merge together despite having the same names, breaks, labels,
etc. I fixed the problem by changing "color" to "colour" in the labs()
function.
Example:
data <- cars
data$group<-rep(LETTERS[1:2])
library(ggplot2)
ggplot(data, aes(x=speed,y=dist,color=group,shape=group)) +
geom_point() + labs(colour="Group",shape="Group")
produces a plot as expected with one legend. However,
data <- cars
data$group<-rep(LETTERS[1:2])
library(ggplot2)
ggplot(data, aes(x=speed,y=dist,color=group,shape=group)) +
geom_point() + labs(color="Group",shape="Group")
produces a plot with two legends and the legend for the color scale is
not relabeled. The only difference is the spelling of color (doesn't
work) vs colour (works) in naming the scales. This took me a bit of
time to track down (in a much more complicated piece of work); so I'm
posting it hoping it will save someone else time in the future.
Best wishes,
Scott