Skip to content

Instantly share code, notes, and snippets.

@diodon
Last active August 20, 2021 00:13
Show Gist options
  • Select an option

  • Save diodon/91c145c6ac3be4c31048c32d6baf12ed to your computer and use it in GitHub Desktop.

Select an option

Save diodon/91c145c6ac3be4c31048c32d6baf12ed to your computer and use it in GitHub Desktop.
OBIS: obtener el listado de especies para la región de Santa Marta, Colombia y hacer un gráfico de barra. Curso OBIS Módulo 4 sección 1.5
library(robis)
library(ggplot2)
library(forcats)
SMwkt <- "POLYGON ((-74.39941 11.21882, -74.29779 11.42349, -73.99292 11.46387, -73.89679 11.37772, -73.96271 11.24306, -74.15222 11.16493,
-74.33624 11.13259, -74.39941 11.21882))"
SMspp <- checklist(geometry = SMwkt)
## make table
taxaTBL <- table(SMspp$taxonRank)
print(taxaTBL)
## make plot
taxa <- as.data.frame(taxaTBL)
pp = ggplot(taxon, aes(x=fct_reorder(factor(Var1), -Freq), y=Freq))
pp + geom_bar(stat = 'identity', fill="steelblue") + coord_flip() +
labs(x="", y="Número de taxa",
caption="Número de taxa por rango taxonómico reportados en OBIS para la región de Santa Marta, Colombia. Fuente: OBIS 2021-08-21") +
theme_pubclean()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment