sample_map: Plot the sampling map

sample_mapR Documentation

Plot the sampling map

Description

Plot the sampling map

Usage

sample_map(
  metadata,
  mode = 1,
  map_params = list(),
  group = NULL,
  point_params = list(),
  label = NULL,
  label_params = list(),
  leaflet_pal = NULL,
  shp_file = NULL,
  crs = 4326,
  xlim = NULL,
  ylim = NULL,
  add_scale = TRUE,
  scale_params = list(),
  add_north_arrow = TRUE,
  north_arrow_params = list()
)

Arguments

metadata

metadata must contains "Longitude","Latitude"

mode

1~3. 1 use basic data from ggplot2. 2 use a shp_file. 3 use the leaflet.

map_params

parameters parse to geom_polygon (mode=1) or geom_sf (mode=2)

group

one column name of metadata which mapping to point color

point_params

parameters parse to geom_point

label

one column name of metadata which mapping to point label

label_params

parameters parse to geom_sf_text

leaflet_pal

leaflet color palette

shp_file

a geojson file parse to sf::read_sf

crs

crs coordinate: https://asa-blog.netlify.app/p/r-map/#crs

xlim

xlim

ylim

ylim

add_scale

add annotation_scale

scale_params

parameters parse to ggspatial::annotation_scale

add_north_arrow

add annotation_north_arrow

north_arrow_params

parameters parse to ggspatial::annotation_north_arrow

Value

map

Examples


data(otutab)
anno_df <- metadata[, c("Id", "long", "lat", "Group")]
colnames(anno_df) <- c("Id", "Longitude", "Latitude", "Group")
if (requireNamespace("ggspatial")) {
  sample_map(anno_df, mode = 1, group = "Group", xlim = c(90, 135), ylim = c(20, 50))
}


pcutils documentation built on June 26, 2024, 1:06 a.m.