ggplot function to add text just below legend

后端 未结 2 1631
误落风尘
误落风尘 2021-01-17 21:03

In R I want to make a function which takes an ggplot object and some text and returns and ggplot object by adds text just below the legend (in the right side of the plot, w

2条回答
  •  借酒劲吻你
    2021-01-17 21:59

    Another easy possibility is to use a caption:

    myplot = ggplot(iris, aes(x=Sepal.Length, y=Sepal.Width, color=Species)) + 
               geom_line() +
               labs(caption = "Mean of Sepal.Width = 3.05")
    

    It's not really right below the legend, though:

提交回复
热议问题