Learn R Programming

SciencesPo (version 1.3.9)

geom_foot: Add Footnote to a ggplot Object

Description

Add footnotes to ggplot2 objects.

Usage

geom_foot(text = NULL, fontsize = 10, color = NULL, rotn = 0,
  just = c("right", "bottom"))

Arguments

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

encoding

UTF-8

Details

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

Examples

Run this code
# setup data
set.seed(51)
supply <- rnorm(100,mean=15-seq(1,6,by=.05),sd=1)
demand <- rnorm(100,mean=4+seq(1,21,by=.2),sd=.5)
time<-seq(1,100,by=1)
data <- data.frame(time, supply,demand)

# make the plot
library(ggplot2)
ggplot(data,aes(time)) +
geom_line(aes(y=demand),size=1.6, color="#008fd5") +
geom_line(aes(y=supply),size=1.6, color="#ff2700") +
theme_fte() +
annotate("text",x=90,y=12,label="Demand") +
annotate("text",x=80,y=23,label="Supply")
geom_foot("danielmarcelino.github.io", color = "#77ab43", rotn = -90, just ="right" )

Run the code above in your browser using DataLab