[R] [External Email] Newbie: Controlling legends in graphs
Christopher Ryan
cry@n @end|ng |rom b|ngh@mton@edu
Tue May 16 16:52:08 CEST 2023
I"m more of a lattice guy than a ggplot guy, but perhaps this is part of
the problem:
.....
> geom_point(aes(y = m_K, color = "red")) + ##### >> you've
> associated "K" with the color red
> geom_smooth(aes(y = m_K, color = "red")) +
> geom_point(aes(y = m_J, color = "blue")) + ###### >> and "J" with
> the color blue
> geom_smooth(aes(y = m_J, color = "blue")) +
>
.....
##### >> but you object about a "blue line for K" and a "red line for J"?
When this runs, the blue line for "K" is above the red line for "J", as
> I expect, but in the legend, the red is shown first, and labeled "blue."
>
> I'd like to be able to create a legend where the first entry shows a
> blue line and is labeled "K" and the second is red and labeled "J".
> Thanks for all your advice and guidance.
>
.......
>
> -Kevin
>
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
[[alternative HTML version deleted]]
More information about the R-help
mailing list