Last active
October 17, 2017 21:57
-
-
Save bbest/db0ff8d37f98afe7a657f055732c3630 to your computer and use it in GitHub Desktop.
try whisker plots on uncertainty estimates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# try whisker plots on uncertainty estimates | |
library(tidyverse) | |
d = tribble( | |
~sp, ~source, ~n, ~cv, | |
'hw', '1999 Smith', 10400, 0.138, | |
'hw', '2003 Stevick', 11570, 0.068, | |
'hw', '2012 Palka', 335, 0.42, | |
'hw', '2016 Roberts', 1633, 0.07, | |
'lbw', '2006 Barlow', 1007, 1.25, | |
'lbw', '2013 Bradford', 4571, 0.65, | |
'lbw', '2017 Bradford', 7619, 0.66) | |
d = d %>% | |
mutate( | |
n_min = n - n*cv, | |
n_max = n + n*cv, | |
pct200 = round(200 / n * 100, 1)) %>% | |
arrange(sp, desc(source)) | |
d | |
ggplot(d %>% filter(sp=='hw'), aes(source, n, ymin=n_min, ymax=n_max)) + | |
geom_pointrange() + coord_flip() + | |
theme_minimal() + | |
theme( | |
axis.text.x = element_text(angle=50), | |
axis.text.y = element_text(angle=50), | |
axis.title.x = element_blank(), # , vjust=0.5, size=16 | |
axis.title.y = element_blank()) # , vjust=0.5, size=16 | |
ggsave('hw_cv.pdf', w=2, h=2, u='in') | |
ggplot(d %>% filter(sp=='lbw'), aes(source, n, ymin=n_min, ymax=n_max)) + | |
geom_pointrange() + coord_flip() + | |
theme_minimal() + | |
theme( | |
axis.text.x = element_text(angle=50), | |
axis.text.y = element_text(angle=50), | |
axis.title.x = element_blank(), # , vjust=0.5, size=16 | |
axis.title.y = element_blank()) # , vjust=0.5, size=16 | |
ggsave('lbw_cv.pdf', w=2, h=2, u='in') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment