Search code examples
rggplot2pie-chartannotategeom-text

Text labels outside ggplot piechart


how do I put a comment outside a ggplot piechart? Ideally in the corner of a window. Any operations including cartesian coordinates somehow ruin the plot. I just need a simple comment about the source of data.

TIA


Solution

  • You can add a labs function to your ggplot and set the caption argument to your desired text. The caption will show up in the lower right by default. For example:

    library(ggplot2)
    
    ggplot(mtcars, aes(mpg, cyl))+
      geom_point() +
      labs(caption="Source: My Work")