Plot the sampling map
sample_map(
metadata,
mode = 1,
map_params = list(),
group = NULL,
point_params = list(),
label = NULL,
label_params = list(),
leaflet_pal = NULL,
map_provider = "OpenStreetMap",
shp_file = NULL,
crs = 4326,
xlim = NULL,
ylim = NULL,
add_scale = TRUE,
scale_params = list(),
add_north_arrow = TRUE,
north_arrow_params = list()
)
metadata must contains "Longitude","Latitude"
1~3. 1 use basic data from ggplot2. 2 use a shp_file. 3 use the leaflet.
parameters parse to geom_polygon (mode=1) or geom_sf (mode=2)
one column name of metadata which mapping to point color
parameters parse to geom_point
one column name of metadata which mapping to point label
parameters parse to geom_sf_text
leaflet color palette
the map provider, default is "OpenStreetMap", see providers
for more options.
a geojson file parse to sf::read_sf
crs coordinate: https://asa-blog.netlify.app/p/r-map/#crs
xlim
ylim
add annotation_scale
parameters parse to ggspatial::annotation_scale
add annotation_north_arrow
parameters parse to ggspatial::annotation_north_arrow
map
# \donttest{
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))
}
#> Loading required namespace: ggspatial
# }