0

I want to obtain a plot that has a legend. In this legend, it shows the names n, and m which are in the dfRand their associated color. However, I have noticed this works only with groups, which is the case for the iris data set. I could be wrong, which is why I am here.

Any help would be appreciated!

# package:
library(tidyverse)

#df:
dfR<-data.frame(h=rnorm(n=5,mean=4,sd=3),
            m=rnorm(n=5,mean=19,sd=10),
            Z=rnorm(n=5,mean=9,sd=6))




  #Plot:
    p<-ggplot(data=dfR, aes(x=h))+
  labs(title="Title",
       subtitle="Subtitle",
       caption="Run number")+
         geom_line(aes(y=m),color="red")+
         geom_line(aes(y=Z),color="purple")
stefan
  • 46,681
  • 5
  • 18
  • 35
Toy L
  • 55
  • 6

0 Answers0