JudyMou
unread,Nov 4, 2010, 6:28:32 PM11/4/10Sign 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 was wondering how to add legend for the fix colour/shape of
aesthetics with fixed value
> data3 = subset(mtcars, cyl != 4.000)
> p <- ggplot(data = subset(mtcars, cyl == 4.000), aes(wt, mpg)) + geom_point()
> p + geom_point(aes(data3$wt, data3$mpg), colour = "blue")
With above command, I've created a graph with two colors. black
indicates cyl!= 4.000, while blue indicates cyl == 4.000. Assume I
made two category, type 1 : cyl != 4.000, and type 2 : cyl == 4.000.
For the legend, I wish to label black is type 1 and red is type 2.
P.S it might not make sense I want to separate cyl to two type. I
wanted to do that because for the data I'm working with, the col cyl
will becomes continuous, and i wish to separate them to two category:
one = 0.25, one !=0.25.
I have been looking for the answer by searching online for the long
time. Please help.
Best,
Judy