add_labs | R Documentation |
add_labs
takes a ggplot object as input and adds to it user-supplied
x, y labels, plot title, subtitle and caption. If user doesn't provide
values to these parameters, it'll just use the values from the input plot
without making changes.
add_labs(p, xlab, ylab, title, subtitle, caption)
p |
A ggplot object. |
xlab |
String, the x-axis label. |
ylab |
String, the y-axis label. |
title |
String, title of the plot. You should use the title to concisely state the main insight the plot reveals. Avoid using generic statement as plot title. For example, "Income vs. Employment Length" is a bad title because it just re-state what the y and x axes are. |
subtitle |
String, subtitle of the plot. You can use the subtitle to explain the details of the insight. You can even write one or more short paragraphs if you have to. |
caption |
String, caption of the plot. You can put anything else useful in caption. For example, data source, method referece, url and etc. |
A ggplot object annotated with xy labels, title, subtitle and caption.
inst/examples/ex-add_labs.R
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.