Learn R Programming

hockeystick (version 0.8.5)

plot_methane: Download and plot essential climate data

Description

Plots atmospheric methane data retrieved using get_methane() with ggplot2. The output ggplot2 object may be modified.

Usage

plot_methane(dataset = get_methane(), print = TRUE, annot = TRUE)

Value

Invisibly returns a ggplot2 object with methane chart

Arguments

dataset

Name of the tibble generated by get_methane

print

(boolean) Display methane 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_methane invisibly returns a ggplot2 object with a pre-defined methane chart using data from get_methane. By default the chart is also displayed. Users may further modify the output ggplot2 chart.

Examples

Run this code
# \donttest{
# Fetch methane data:
ch4 <- get_methane()
#
# Plot output using package's built-in ggplot2 defaults
plot_methane(ch4)

# Or just call plot_methane(), which defaults to get_methane() dataset
plot_methane()

p <- plot_methane(ch4, print = FALSE)
# Modify plot such as: p + ggplot2::labs(title='Trend in Atmospheric Methane') # }

Run the code above in your browser using DataLab