Skip to content

Instantly share code, notes, and snippets.

@jhnwllr
Created October 25, 2021 10:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhnwllr/ff72212a51b0e7bf9303011e2474b6af to your computer and use it in GitHub Desktop.
Save jhnwllr/ff72212a51b0e7bf9303011e2474b6af to your computer and use it in GitHub Desktop.
Classic GBIF barplot used for everything
library(ggplot2)
breaks = scales::pretty_breaks(n = 5)(c(0,3e6))
labels = gbifapi::plot_label_maker(breaks,unit_MK = "K",unit_scale = 1e-3)
p = ggplot(pd,aes(class,n)) +
scale_y_continuous(breaks = breaks,label = labels) +
geom_col(stat="identity",fill="#4B9E46") +
coord_flip() +
xlab("") +
ylab("number of 'sensitive' occurrences") +
theme_bw() +
theme(axis.text.y=element_text(face="plain",size=12,color="#535362")) +
theme(axis.title.x = element_text(margin = margin(t = 10, r = 0, b = 5, l = 0), size = 11, face="plain")) +
labs(caption="sensitive = on CITES + certain location + NT,VU,EN,CR")
save_dir = "C:/Users/ftw712/Desktop/iucn_project_2021/plots/"
gbifapi::save_ggplot_formats(p,save_dir,"class_barplot",height=4,width=6,formats=c("pdf","jpg","svg"))
@jhnwllr
Copy link
Author

jhnwllr commented Oct 25, 2021

class_barplot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment