Learn R Programming

hockeystick (version 0.8.5)

plot_carbon: Download and plot essential climate data

Description

Plots carbon dioxide data retrieved using get_carbon() with ggplot2. The output ggplot2 object may be modified.

Usage

plot_carbon(dataset = get_carbon(), print = TRUE, annot = TRUE)

Value

Invisibly returns a ggplot2 object with carbon dioxide chart

Arguments

dataset

Name of the tibble generated by get_carbon

print

(boolean) Display carbon dioxide ggplot2 chart, defaults to TRUE. Use FALSE to not display chart.

annot

(boolean) Include chart annotation with latest date and value, defaults to TRUE.

Author

Hernando Cortina, hch@alum.mit.edu

Details

plot_carbon invisibly returns a ggplot2 object with a pre-defined carbon dioxide chart using data from get_carbon. By default the chart is also displayed. Users may further modify the output ggplot2 chart.

Examples

Run this code
# \donttest{
# Fetch carbon dioxide data:
maunaloa <- get_carbon()
#
# Plot output using package's built-in ggplot2 defaults
plot_carbon(maunaloa)

# Or just call plot_carbon(), which defaults to get_carbon() dataset
plot_carbon()

p <- plot_carbon(maunaloa, print = FALSE)
# Modify plot such as: p + ggplot2::labs(title='The Keeling Curve') # }

Run the code above in your browser using DataLab