How to add custom series labels to a legend in R's ggplot?

前端 未结 1 745
情深已故
情深已故 2021-01-05 19:17

I have a plot (sample code pasted below) that I am trying to add by own labels for the series information. Instead of plotting \"p1s1\" \"p1s2\" \"p3s4\", I would like \"tr

相关标签:
1条回答
  • 2021-01-05 19:21

    maybe you can relabel your factor?

    growth_series$series_id <- factor(
         growth_series$series_id, 
         labels=c('treatment 1', 't2', 't3'))
    

    Or if you are still looking for scale_something, it should be scale_colour_hue()

    ... + scale_colour_hue('my legend', 
       breaks = levels(growth_series$series_id), 
       labels=c('t1', 't2', 't3'))
    
    0 讨论(0)
提交回复
热议问题