plot_clusters: Plot spatial clusters

View source: R/plot_clusters.R

plot_clustersR Documentation

Plot spatial clusters

Description

plot_clusters plots the clusters on a map

Usage

plot_clusters(
  fit,
  var_name = "D_gct",
  transform_var = log,
  k = 4,
  method = "ward",
  year_labels = fit$year_labels,
  category_names = fit$category_names,
  map_list = NULL,
  working_dir = getwd(),
  file_name = paste0("Class-", var_name),
  file_name2 = paste0("Class-", var_name, "-averages"),
  replace_Inf_with_NA = TRUE,
  size_threshold = 1e+05,
  col = viridisLite::viridis,
  yaxis_log = TRUE,
  ...
)

Arguments

var_name

Name of object from fit$Report that is used. Only implemented options are "D_gct","Omega1_gc","Omega2_gc","Epsilon1_gct","Epsilon2_gct".

transform_var

function to apply to fit$Report[[var_name]] prior to clustering. I recommend using log-transform for density, and otherwise using transform_var=identity.

k

an integer scalar or vector with the desired number of groups

method

Distance metric. Default method="ward" is very fast, but can instead use method="bcdist" for small problems which calculates Bray-Curtist dissimilarity using bcdist and then applies Ward clustering

map_list

output from make_map_info output

replace_Inf_with_NA

Boolean whether to replace Inf or -Inf values with NA prior to clustering, as useful sometimes when var_name="D_gct", transform_var=log and replacing nonencounters with zero.

Details

Code to plot clusters to look for biogeographic shifts, as well as plotting averages across all sites-times assigned to a each cluster, for use when interpreting each cluster.

References

For details regarding spatial clustering see https://doi.org/10.1093/icesjms/fsac007


James-Thorson/FishStatsUtils documentation built on Feb. 6, 2024, 4:26 a.m.