Skip to contents

given a list of terra rasters to plot, use heat gradient to display values, but cut off the top X percent and replace those values with the top color (red in this case) in order to handle extreme outliers. Currently this does _not_ print the max range (outliers) in the legend

Usage

plot_rasters_squish_outliers(
  raster_list,
  title = "",
  subtitle = "",
  scale_label = "",
  cut_percent = 0,
  max_threshold_value = NA,
  min_threshold_value = NA,
  break_width = NA,
  palette_name = "bgyr"
)

Arguments

raster_list

terra spat raster list (or stack?)

title

character title of the plot, default is empty title

scale_label

character, label to print above the legend/scale

cut_percent

numeric percentile cut-off, see percentile_cutoff_value function for descriptoin, but 1 will cut top 1 percent, 0.25 will cut to 0.25% off and display as top color (e.g. red)

max_threshold_value

numeric optional numeric cut off the range display. if this is sent, then cut_percent is ignored

min_threshold_value

numeric optional numeric cut off the bottom of the range.

break_width

numeric, default NA. If this is set, then uses the non-continous bars and this is the width of those

palette_name

string this must be a valid palette from

Value

ggplot object, one map for each item in raster_list with single legend