[R] [External Email] Newbie: Controlling legends in graphs
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
> 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.
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
[[alternative HTML version deleted]]
More information about the R-help