Passer au contenu

[Deprecated]

elsar_plot_static_raster_c() is deprecated. Please use elsar_plot_static_raster() with data_type = "continuous" instead.

Utilisation

elsar_plot_static_raster_c(
  raster_in,
  type = "ggplot_vector",
  background = NULL,
  extend_background = 0.05,
  custom_palette = NULL,
  plot_title = "",
  legend_title = NULL,
  color_map = "viridis",
  expand_plot = FALSE,
  raster_df_out = FALSE
)

Arguments

raster_in

The SpatRaster file to be plotted.

type

A character of the plot type. Either "ggplot_vector", "ggplot_raster" or "tmap".

background

Requires a SpatRaster input (preferably with the same data as raster_in) to plot the background data.

extend_background

A numerical value that allows to extent the background beyond the extent of raster_in. If extend_background <= 1, the lat and lon extend will be extended by the ratio provided (e.g. 0.05 will extend it by 5%). If extend_background > 1 all sides will be extended by the absolute value provided.

custom_palette

An optional custom palette for plotting. Default uses the viridis package.

plot_title

An optional plot title.

legend_title

An optional legend title.

color_map

The name of the viridis palette to be used. Default is "viridis".

expand_plot

Logical. Whether to expand the plot, so there is no space between border and plot.

raster_df_out

Logical. Whether to return only the plot (FALSE) or also the data frame behind the plot (TRUE). Needed for elsar_plot_distribution().

Valeur de retour

A ggplot or tmap object.

Voir également

elsar_plot_static_raster() for the unified plotting function

Exemples

if (FALSE) { # \dontrun{
boundary_proj <- make_boundary(
  boundary_in = boundary_dat,
  iso3 = "NPL",
  iso3_column = "iso3cd"
)

pus <- make_planning_units(
  boundary_proj = boundary_proj,
  iso3 = "NPL",
  pu_size = NULL,
  pu_threshold = 8.5e5,
  limit_to_mainland = FALSE
)
wad_dat <- get_wad_data()

wadOut <- make_normalised_raster(
  raster_in = wad_dat,
  pus = pus,
  iso3 = "NPL"
)
(wad_plot <- elsar_plot_static_raster_c(
  raster_in = wadOut,
  type = "ggplot_raster",
  background = wad_dat,
  legend_title = "wad"
))
} # }