1

I would like to add some totals on the right side of the plot (above and under the legend). And also under the title of the x axis.

I found how to add text within the plot, or add multiple legends of something ploted, but I don't want to do either one. I just want to calculate some totals and display them as mentioned above. Is it in any way possible?

As it is now: enter image description here

As I would like it to be: enter image description here

adlisval
  • 341
  • 1
  • 7
  • 17
  • 3
    Look into cowplot package. There is `draw_label` function that helps to put text anywhere on the plot. – zx8754 Jan 20 '17 at 12:42
  • 2
    Possible duplicate of [How to annotate ggplot2 qplot outside of legend and plotarea? (similar to mtext())](http://stackoverflow.com/questions/13009135/how-to-annotate-ggplot2-qplot-outside-of-legend-and-plotarea-similar-to-mtext) – Axeman Jan 20 '17 at 13:19
  • You could use shiny to add text under the x-axis,but I don't see how you can expect to add something above and/or under the legend without modifying the plot. Shiny has no idea where the legend is, it is just a bitmap for Shiny. – Mike Wise Jan 20 '17 at 16:52
  • from cowplot: ggdraw(p) + draw_label("bottom left at (0, 0)", x = 0, y = 0, hjust = 0, vjust = 0) – rm1104 Feb 01 '21 at 16:22

0 Answers0