Plot the sampling map
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
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
# }