#' 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 the phrase used to search for taxa in the origional function, and labels are based on the year recorded and scientific name.
#'
#' @param df A dataframe generated by Pull_Cort you'd like to map
#' @return Outputs a map colored according to searched taxa and labeled according to scientific name.
#' @export YearColorMap
YearColorMap <- function(df){
tot_merged <- unite(df, year_and_name, year, acceptedScientificName)
levs <- factor(df$column_label)
Mapss <- mutate(df, year_and_name = tot_merged$year_and_name)
factpal <- colorFactor( palette = magma(length(levs)
), levs)
Mapss %>%
group_by(scientificName) %>%
leaflet() %>%
addTiles() %>%
addCircleMarkers(
~decimalLongitude,
~decimalLatitude,
color = ~factpal(column_label),
stroke = FALSE, fillOpacity = 0.5, label = Mapss$year_and_name
) %>% addLegend(position = "bottomright", pal = factpal, values = ~column_label, title = "Taxa")}
#This function requires leaflet, dplyr, viridis, and tidyr libraries
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.