#' Generates a color-blind friendly map based on locations from a dataframe generated by Pull__Cort
#'
#' Generates a map of taxa based on locations provided by a dataframe generated by the Pull__Cort function. Plot points are colored according to the phrase used to search for taxa in the origional function, and labels are based on the scientific name, author, and year reported if all are available.
#'
#' @param df A dataframe generated by Pull_Cort you'd like to map
#' @export ColorMap
YearColorMap <- function(df){
levs <- factor(df$column_label)
factpal <- colorFactor( palette = magma(length(levs)
), levs)
df %>%
group_by(scientificName) %>%
leaflet() %>%
addTiles() %>%
addCircleMarkers(
~decimalLongitude,
~decimalLatitude,
color = ~factpal(column_label),
stroke = FALSE, fillOpacity = 0.5, label = df$year , label = df$acceptedScientificName
) %>% addLegend(position = "bottomright", pal = factpal, values = ~column_label, title = "Taxa")}
#This function requires leaflet, dplyr, and viridis libraries
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.