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. dataframe, data table, named matrix, etc.  | 
metric | 
 character; The metric to display in the z axis. There should be a corresponding column name.  | 
bins | 
 Either a single number indicating the number of bins, or a vector that specifies where the bins will be cut.  | 
ascending | 
 logical; Do increasing values in the metric indicate increasingly acceptable performance?  | 
range | 
 A vector of length two that defines the max and min value of the scale.  | 
colors | 
 Provide a list representing a color scale.  | 
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 7 8 9  | df <- expand.grid(temp=0:8,precip=seq(0.7,1.3,by=0.1))
df$rel <- seq(40,100,length=63)
climate_heatmap_continuous(df,"rel")
climate_heatmap_continuous(df,"rel", bins = 4)
climate_heatmap_continuous(df,"rel", bins = c(20, 30, 50, 80, 100), range = c(20, 100))
colors <- grDevices::colorRampPalette(c("firebrick2", "deepskyblue2"))(7)
climate_heatmap_continuous(df, "rel", bins = 7, colors = colors) +
  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.