Description Usage Arguments Details Value Examples
Creates a ggplot2 heatmap with temperature on the x axis, preciptation on the y axis, and a given metric on the z axis.
1 2 3 |
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 |
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) |
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.
A ggplot2 object representing the heatmap.
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))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.