In this vignette is discussed about outliers in Whittaker biomes plots using the plotbiomes package.

About outliers

Some precipitation-temperature points may end up outside of the Whittaker biome polygons. This is not unusual and Ricklefs (2008) mentiones that

“Most of the points fall within a triangular region that includes almost the full range of climates. Only the climates of high mountains do not fall within the triangle.”

(Ricklefs, R. E. (2008), The economy of nature. W. H. Freeman and Company.; Chapter 5, Biological Communities, The biome concept; Caption of Figure 5.5)

Nevertheless, one might want to check such points. For example, temperature and precipitation values could be biased because the spatial location was not correctly specified (errors in coordinates). In such cases is very helpful to know the indices of the outliers. This is where the get_outliers() and map_outliers() functions from plotbiomes package come in handy.

As presented here one can extract temperature and precipitation values and construct a plot like the one below (note the outliers):

Some points fall outside the triangular region

Some points fall outside the triangular region

Get the outliers

The function get_outliers() does exactly what its name suggests:

my_outliers <- get_outliers(tp = extractions[, 2:3])
my_outliers
##    row_idx  temp pp_cm
## 1:       3 -15.3  86.5
## 2:       8 -23.4  64.6
## 3:      30 -16.2  20.0
## 4:      34 -20.0  13.4
## 5:      39 -19.6  30.5
## 6:      46 -16.8  22.1
## 7:      50 -17.4  33.7

Below is some code to color/underline the outliers on the Whittaker biome plot (check more coloring options in the vignette Whittaker_biomes_examples.html):

library(plotbiomes)
library(ggplot2)

# Color the outliers
extractions$status <- ifelse(extractions$ID %in% my_outliers$row_idx, "out", "in")

# Note that `fill` cannot be used again in the aesthetics 
# because is already in use for biome polygons color filling.
whittaker_base_plot() +
  geom_point(data = extractions,
             aes(x = temperature,
                 y = precipitation),
             shape  = 21,
             stroke = 1, # acts as the thickness of the boundary line
             colour = "gray95", # acts as the color of the boundary line
             size   = 3.5) +
  geom_point(data = extractions,
             aes(x = temperature,
                 y = precipitation,
                 color = status),
             shape = 16,
             size  = 3,
             alpha = 0.5) +
  scale_color_manual(name   = "Status",
                     breaks = c("in", "out"),
                     values = c("in"  = "black",
                                "out" = "red"),
                     labels = c("in"  = "inside",
                                "out" = "outlier")) +
  theme_bw()
Colored outliers

Colored outliers

Map the outliers

The function map_outliers() does exactly what its name suggests. This function makes use of the mapview package functionality to produce interactive views of temperature-precipitation outliers.

map_outliers(tp =  extractions[, 2:3], xy = points@coords)

.

map_outliers() is a simple wrapper of mapview::mapView() function to which arguments can be passed:

map_outliers(tp =  extractions[, 2:3], xy = points@coords, 
             col.regions = "red", basemaps = c("OpenTopoMap", "Esri.WorldImagery"))