plot.apa_list: plot APA-maps

Description Usage Arguments Examples

View source: R/plot_apa_list.R

Description

APA-maps that are stored in an APA-list-object are being plotted.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## S3 method for class 'apa_list'
plot(
  x,
  subset = NULL,
  color_map = 1,
  tree_size_column = attr(x, "apa_config")$weight_column,
  tree_size_scale = 1,
  pal = sf::sf.colors,
  single_plots = FALSE,
  add_legend = TRUE,
  critical = "#FF000033",
  add = FALSE,
  cex = graphics::par("cex"),
  add_subplot = FALSE,
  add_plot_id_values = TRUE,
  ...
)

Arguments

x

A apa_list-object.

subset

The subset of APA-maps in apa_list that will be plotted (see subset.apa_list).

color_map

If numeric or character, this argument specifies which aggregation class should be used for coloring APA-patches (see apa_add_agg_class()). By supplying a data.frame, a custom color scheme can be specified. The first column of the data.frame needs to match with a categorical column in tree_dat and the second column specifies the colors.

tree_size_column

Column name in tree_dat that is used to adjust point sizes of tree locations. If this column is a metric units object, it is scaled to meters to match the units of the axes.

tree_size_scale

If tree_size_column is a metric units object, it is multiplied with tree_size_scale. Otherwise, tree_size_scale specifies the size of the largest point in meters.

pal

If no color_map is provided, this color palette function is used for coloring. specified here.

single_plots

Should the APA-maps be plotted as individual plots (TRUE) or should all APA-maps be plotted in a single diagram (FALSE, default)?

add_legend

If TRUE (default), a legend will be plotted.

critical

A color to shade the critical area close to the plot borders that may be influenced by an edge effect.

add

If FALSE (default), the plot will be standalone, otherwise it will be added to the currently active plot.

cex

Character expansion factor for labels (legend, titles)

add_subplot

If TRUE, subplots that were added via apa_add_subplot_dat will be added to the plot (default is FALSE).

add_plot_id_values

If TRUE (default), plot id's will be added as title.

...

not implemented.

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
30
library(APAtree)
data(tree_enrico, package = "APAtree")
data(plot_enrico, package = "APAtree")
data(subplot_enrico, package = "APAtree")

tree_enrico$height_class <- cut(tree_enrico$height, breaks = seq(0, 40, 4))

# only calculating an apa_list for two plots and with a coarse resolution of 1 m
# to save time.
apa_list_enrico <- 
  apa_list(plot_dat = subset(plot_enrico, id_plot %in% c("5.2", "8.2")), 
           tree_dat = tree_enrico,
           plot_id_column = "id_plot",
           tree_id_column = "id_tree",
           weight_column = "crown_radius_95",
           agg_class_column = c("species", "height_class"),
           res = 1,
           apa_polygon = TRUE)

# plot all APA-maps in an apa_list:
plot(apa_list_enrico)

# choose a different palette for plotting
plot(apa_list_enrico, pal = rainbow)

# choose a custom color scheme
color_map <- 
  data.frame(species = c("Fagus sylvatica", "Pseudotsuga menziesii"),
             species_color = c("#7d5831", "#bcc746"))
plot(apa_list_enrico, color_map = color_map)

JonasGlatthorn/APAtree documentation built on Dec. 18, 2021, 1:41 a.m.