map_gist | R Documentation |
Make an interactive map to view in the browser as a GitHub gist
map_gist( x, description = "", public = TRUE, browse = TRUE, lon = "longitude", lat = "latitude", name = NULL, ... )
x |
The data. An object of class |
description |
Description for the Github gist, or leave to default (=no description) |
public |
(logical) Whether gist is public (default: |
browse |
If |
lon, lat |
(character) Longitude and latitude variable names. Ignored
unless |
name |
(character) the column name that contains the name to use in
creating the map. If left |
... |
Further arguments passed on to |
See gistr::gist_auth()
for help on authentication
Does not support adding a convex hull via hull()
## Not run: ## spocc library("spocc") spp <- c('Danaus plexippus', 'Accipiter striatus', 'Pinus contorta') dat <- spocc::occ(spp, from=c('gbif','ecoengine'), limit=30, gbifopts=list(hasCoordinate=TRUE)) # Define colors map_gist(dat, color=c('#976AAE','#6B944D','#BD5945')) # Define colors and marker size map_gist(dat, color=c('#976AAE','#6B944D','#BD5945'), size=c('small','medium','large')) # Define symbols map_gist(dat, symbol=c('park','zoo','garden')) ## rgbif if (requireNamespace("rgbif")) { library("rgbif") ### occ_search() output res <- occ_search(scientificName = "Puma concolor", limit = 100) map_gist(res) ### occ_data() output res <- occ_data(scientificName = "Puma concolor", limit = 100) map_gist(res) #### many taxa res <- occ_data(scientificName = c("Puma concolor", "Quercus lobata"), limit = 30) res map_gist(res) } ## data.frame df <- data.frame(name = c('Poa annua', 'Puma concolor', 'Foo bar'), longitude = c(-120, -121, -121), latitude = c(41, 42, 45), stringsAsFactors = FALSE) map_gist(df) ### usage of occ2sp() #### SpatialPoints spdat <- occ2sp(dat) map_gist(spdat) #### SpatialPointsDataFrame spdatdf <- as(spdat, "SpatialPointsDataFrame") map_gist(spdatdf) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.