Skip to contents

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)

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.

Value

Invisibly returns a ggplot2 object with carbon dioxide chart

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.

Author

Hernando Cortina, hch@alum.mit.edu

Examples

# \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') # }