Learn R Programming

SciencesPo (version 1.02.12)

addFootnote: Add Footnote to a ggplot Object

Description

Add footnotes to ggplot2 objects.

Usage

addFootnote(x = NULL, size = NULL, color = NULL, rotation = 90,
  justification = c("right", "bottom"))

Arguments

x
any text or empty to use default.
size
the font size x.
color
the color for x.
rotation
the rotation for the footnote, default is rotation=90.
justification
the justification method.

Details

At this stage, this function only works for a ggplot object.

Examples

Run this code
# setup data
x <- seq(0, 50, 1)
supply <- x * -2 + 100
demand <- x * 2
df <- data.frame( x = x, supply=supply, demand=demand)

library(ggplot2)
ggplot(df, aes(x)) +
geom_line(aes(y = supply, colour = supply))+
geom_line(aes(y = demand, colour = demand))
addFootnote(size = .9, color = "red")

Run the code above in your browser using DataLab