---
title: "Holdridge plots"
author: "Martin R. Smith"
date: "`r Sys.Date()`"
output: rmarkdown::html_document

vignette: >
  %\VignetteIndexEntry{Holdridge plots}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r hcl-colors-hack, echo=FALSE}
if (getRversion() < "3.6") {
  hcl.colors <- function(n, ...) {
    colorRampPalette(c("#4B0055", "#274983", "#008298", "#00B28A",
                         "#7ED357", "#FDE333"))(n)
  }
}
```

`HoldridgePlot()` creates a blank triangular plot, as proposed by 
Holdridge (1947, 1967), onto which potential evapotranspiration
(PET) ratio and annual precipitation data can be plotted
(using the `AddToHoldridge()` family of functions) in order to interpret
climatic life zones.

`HoldridgePoints()`, `HoldridgeText()` and related functions allow data 
points to be added to an existing plot; `AddToHoldridge()` allows plotting
using any of the standard plotting functions.

`HoldridgeBelts()` and `HoldridgeHexagons()` plot interpretative lines
and hexagons allowing plotted data to be linked to interpreted climate
settings.

Please cite Tsakalos _et al._ (2023) when using this function.


```{r holdridge, fig.asp = 1}
# Load package and data
library("Ternary")

data(holdridge, holdridgeLifeZonesUp, package = "Ternary")

# Suppress plot margins
par(mar = c(0, 0, 0, 0))

# Create blank Holdridge plot
HoldridgePlot(hex.labels = holdridgeLifeZonesUp)
HoldridgeBelts()

# Plot data, shaded by latitude
HoldridgePoints(holdridge$PET, holdridge$Precipitation,
                col = hcl.colors(91)[abs(holdridge$Latitude) + 1],
                lwd = 2)

# Add legend to interpret shading
PlotTools::SpectrumLegend(
  "topright", bty = "n", # No box
  horiz = TRUE, # Horizontal
  x.intersp = -0.5, # Squeeze in X direction
  legend = paste0(seq(0, 90, 15), "°"),
  palette = hcl.colors(91),
  title = "Latitude"
)
```

# References

Holdridge (1947),
"[Determination of world plant formations from simple climatic data](https://dx.doi.org/10.1126/science.105.2727.367)",
_Science_ 105:367--368.

Holdridge (1967),
[_Life zone ecology_](https://reddcr.go.cr/sites/default/files/centro-de-documentacion/holdridge_1966_-_life_zone_ecology.pdf).
Tropical Science Center, San Jos&eacute;.

Tsakalos, Smith, Luebert & Mucina (2023).
"[climenv: Download, extract and visualise climatic and elevation data.](
https://dx.doi.org/10.1111/jvs.13215)",
_Journal of Vegetation Science_ 6:e13215.
