Learn R Programming

hockeystick (version 1.0.0)

plot_cmip6: Download and plot essential climate data

Description

Plots gridded CMIP6 climate projections retrieved using get_cmip6() with ggplot2.

Usage

plot_cmip6(
  dataset = get_cmip6(),
  palette = "Spectral",
  xlim = NULL,
  ylim = NULL,
  country = NULL,
  state = NULL,
  mask = TRUE,
  print = TRUE
)

Value

Invisibly returns a ggplot2 object with the projection map.

Arguments

dataset

Name of the tibble generated by get_cmip6

palette

(string) Color palette name passed to RColorBrewer. Defaults to "Spectral" reversed for temperature-type variables.

xlim, ylim

(numeric) Optional two-element longitude/latitude bounds to zoom the map to a region, e.g. xlim = c(-130, -60), ylim = c(20, 70).

country

(string) Optional country name or ISO 3166-1 alpha-3 code to zoom the map to that country. Requires the geodata package.

state

(string) Optional state/province name (admin-1), used together with country to zoom to a subnational region, e.g. country = "MEX", state = "Sonora". Requires the geodata package.

mask

(boolean) If country is given, blank cells outside the country border, defaults to TRUE.

print

(boolean) Display map, defaults to TRUE.

Details

plot_cmip6 returns a pre-defined ggplot2 world map of projected values. Regions may be selected by coordinates (xlim/ylim), by country, or by state/province. Users may further modify the output chart.

Examples

Run this code
# \donttest{
proj <- get_cmip6()
plot_cmip6(proj)
#
# Zoom to the contiguous United States. Explicit xlim/ylim override the
# country's bounding box, excluding Alaska and Hawaii from the view:
plot_cmip6(proj, country = 'USA', xlim = c(-125, -66), ylim = c(24, 50))
#
# Or zoom to a single state:
plot_cmip6(proj, country = 'MEX', state = 'Sonora') # }

Run the code above in your browser using DataLab