Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201894

How do I color ggplot lines and adjust the legend? [duplicate]

$
0
0

I am trying to color my lines in ggplot to be red and blue, but they seem to have reversed colors.

ggplot(data.frame(x)) +
  geom_line(aes(x=x, y=y, color='blue')) +
  geom_line(aes(x=x, y=y2, color='red')) +
  labs(title ="Normal Distribution Curve & Normal CDF Curve ")

To that end, how can I override the text in the legend to not say "red" and "blue" but instead be labeled "distribution 1" and "distribution 2"?

img


Viewing all articles
Browse latest Browse all 201894

Trending Articles