climate_heatmap_binary: Create a binary climate heatmap.

Description Usage Arguments Details Value Examples

Description

Creates a ggplot2 heatmap with temperature on the x axis, preciptation on the y axis, and a given metric on the z axis.

Usage

1
2
3
climate_heatmap_binary(data, metric, threshold = NULL, ascending = TRUE,
  color_scale = NULL, metric_col = metric, to_percent = c(FALSE, TRUE),
  z_axis_title = "Range")

Arguments

data

The data. Could be dataframe, data table, named matrix, etc.

metric

character; The metric to display in the z axis. There should be a corresponding column name.

threshold

numeric; Determines when performance changes from acceptable to unacceptable.

ascending

logical; Do increasing values in the metric indicate increasingly acceptable performance?

color_scale

Provide a vector of length 2 representing a color scale.

metric_col

character; the name of the column where the metric resides in data. This defaults to metric.

to_percent

list; List of length two that says whether or not (temp, precip) data should be treated as percent changes (e.g. 1 means 0 0.9 means -10% change, 1.2 means 20% change...)

z_axis_title

Title of Z axis (represented by color)

Details

In order for this function to work, you must have a column named "temp" and another named "precip". Beyond that, you can have as many columns as you'd like.

Because this is a ggplot2 object, you should be able to overwrite many of settings defined here.

Value

A ggplot2 object representing the heatmap.

Examples

1
2
3
4
5
6
df <- expand.grid(temp=0:8,precip=seq(0.7,1.3,by=0.1))
df$rel <- seq(40,100,length=63)
climate_heatmap_binary(df,"rel",80)

climate_heatmap_binary(df,"rel", color_scale = c("firebrick2","deepskyblue2")) +
 ggplot2::theme(text = ggplot2::element_text(size = 18))

tbadams45/wrviz documentation built on May 31, 2019, 3:58 a.m.