r - Delete one aes from legend generated from two layes sharing common aes name -



r - Delete one aes from legend generated from two layes sharing common aes name -

my question want overlay scatter plot on top of line plot , these 2 plots' color alter 1 variable. want maintain legend 1 color. if utilize scale_colour_discrete(guide = "none") both of them gone.

a reproducible illustration is:

library(reshape2) iris2 <- melt(iris, id.var = "species") ggplot(iris2, aes(x = variable, y = value, grouping = species)) + geom_point(aes(color = ifelse(value < 3, "type1", "type2"))) + geom_line(aes(color = species))

i want show legend 'species' rather type.

setting show_guide=false in geom_point layer,

ggplot(iris2, aes(x = variable, y = value, grouping = species)) + geom_point(aes(color = ifelse(value < 3, "type1", "type2")), show_guide=false) + geom_line(aes(color = species)) + scale_colour_discrete("species", breaks=levels(iris2$species))

r ggplot2

Comments

Popular posts from this blog

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -