Description Usage Arguments Value Examples
View source: R/plot_footnote.R
This function adds footnote to the ggplot
object and returns gtable
object.
1 2 3 4 5 6 7 8 9 10 11 12 | plot_footnote(
p,
note,
caption = FALSE,
fontsize = NULL,
fontcol = "black",
align = "right",
distance.from.side = 0.05,
distance.from.bottom = 0.75,
bottom.expand.rate = NULL,
show.plot = TRUE
)
|
p |
|
note |
The content of footnote (character). Line break is allowed by using |
caption |
Use caption option in ggplot2. If |
fontsize |
The size of font. If |
fontcol |
The color of the font. The default is |
align |
The alignment of the footnote text. Either |
distance.from.side |
The horizontal distance of notes from the edge of graph space by the proportion of graph width (numeric: 0-1). The default is |
distance.from.bottom |
The vertical distance of notes from the bottom of graph bottom by the proportion of bottom graph margin height (numeric: 0-1). The default is |
bottom.expand.rate |
The expansion rate of the bottom margin of the graph to incorporate footnote (numeric). The value of |
show.plot |
Print the plot at the end of function (boulean). The default is |
gtable
object. It is impossible to add aditional ggplot elements to this object. Plot can be viewed by using either grid.draw()
or plot()
function.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ## Load Data
library(pscl)
data(vote92)
## Recode Variables
vote92$voteBush <- as.numeric(
factor(vote92$vote,levels=c("Clinton","Bush")))*1 - 1
vote92$bushdis <- sqrt(vote92$bushdis)
vote92$clintondis <- sqrt(vote92$clintondis)
## Estimate Logistic Regression
fm <- formula(voteBush ~ dem + rep +
clintondis + bushdis +
persfinance + natlecon)
m <- glm(fm, data = vote92,
family = binomial("logit"))
## Basic Graph
p <- plot_coef(m)
## Add Footnote
p_wfoot <- plot_footnote(p,"Votes for Ross Perot are eliminated from analysis.")
p_wfoot
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.