3

Is it possible to add a banner to the bottom of a ggplot? For example,

Turn this:

ggplot(mtcars) + stat_density(aes(x = mpg))

enter image description here

Into this:

enter image description here

moku
  • 4,099
  • 5
  • 30
  • 52
  • Possibly this post gives you a direction to look: http://stackoverflow.com/questions/13009135/how-to-annotate-ggplot2-qplot-outside-of-legend-and-plotarea-similar-to-mtext – vpipkt Feb 24 '15 at 22:07
  • There's nothing in ggplot specifically for this, but ggplot is build on the grid package. You can look into mucking about with grid viewports to add any content you want to the graphics device. – MrFlick Feb 24 '15 at 23:05
  • You might take guidance from [this example](http://stackoverflow.com/questions/26644728/add-image-png-file-to-header-of-pdf-file-created-with-r/26851776#26851776) using `gtable` or [this example](http://stackoverflow.com/questions/12463691/inserting-an-image-to-ggplot-outside-the-chart-area/12486301#12486301) using `grid`. – Sandy Muspratt Feb 24 '15 at 23:15
  • I don't think this question is a duplicate necessarily. Two things: as of ggplot 2.1.0.9000 (dev version, as of this comment), you can subtitles and captions to plots via `+labs(title="Title",subtitle="A subtitle",caption="Source of data...")`. Also, I posted a question about a function I created to add a ribbon to the bottom of a plot. It's not perfect but it might help: see [here](http://stackoverflow.com/questions/36071468/add-info-ribbon-flush-to-bottom-of-ggplot?noredirect=1#comment59789368_36071468) – Tim_K Mar 18 '16 at 14:35

0 Answers0