bivarmap_map: Plots bivariate maps

Description Usage Arguments Value Examples

View source: R/bivarmap_map.R

Description

This function plots bivariate maps with their color matrix associated with gradients in the two variables or dimensions.

Usage

1
2
3
4
5
6
7
8
bivarmap_map(
  bivarmap,
  colmatrix,
  x_legend_pos = 0,
  y_legend_pos = 0,
  x_legend_size = 0.2,
  y_legend_size = 0.2
)

Arguments

bivarmap

[RasterLayer,SpatRaster]
Bivariated classified map, such as one generated by bivarmap_raster().

colmatrix

[matrix]
Matrix of colors to be used in the raster classification and plot, created with colmatrix().

Value

A ggplot plot of the bivariate map, with colors following a bivariate color matrix, which is optionally also plotted.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# package
library(bivarmap)

# data
data("temprec")
temprec

# color matrix
colmatrix <- bivarmap::bivarmap_colmatrix(nbreaks = 9,
                                          xlab = "Temperatura",
                                          ylab = "Precipitação")
colmatrix

# raster
raster_col <- bivarmap::bivarmap_raster(rasterx = temprec$temp,
                                        rastery = temprec$prec,
                                        colmatrix = colmatrix)
raster_col

# plot map
bivarmap::bivarmap_map(bivarmap = raster_col,
                       colmat = colmatrix,
                       x_legend_pos = .2,
                       y_legend_pos = .1,
                       x_legend_size = .3,
                       y_legend_size = .3)

plot(raster_col)
plot(temprec)

mauriciovancine/bivarmap documentation built on Feb. 21, 2022, 5:31 p.m.