Created
March 22, 2019 15:11
-
-
Save fawda123/509228ffac89cda682c6a928c69f779a to your computer and use it in GitHub Desktop.
plot asci/csci diff by nuts and hab
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
library(tidyverse) | |
library(patchwork) | |
toplo1 <- sqidat %>% | |
select(MasterID, yr, asci_mean, csci_mean, TN, TP, indexscore_cram) %>% | |
gather('nuts', 'val', TN, TP) %>% | |
na.omit %>% | |
mutate( | |
inddif = asci_mean - csci_mean, | |
cramcat = case_when( | |
indexscore_cram > 72 ~ 'CRAM hi (> 72)', | |
indexscore_cram <= 72 ~ 'CRAM lo (<= 72)' | |
), | |
cramcat = factor(cramcat, levels = c('CRAM lo (<= 72)', 'CRAM hi (> 72)')) | |
) | |
p1 <- ggplot(toplo1, aes(x = val, y = inddif)) + | |
geom_point() + | |
geom_hline(yintercept = 0) + | |
facet_wrap(cramcat ~ nuts, scales = 'free') + | |
scale_x_log10() + | |
ylab('ASCI_H - CSCI') + | |
xlab('Nutrient concentration') + | |
theme_bw() + | |
theme(strip.background = element_blank()) + | |
stat_smooth(method = 'lm') | |
png('C:/Users/Marcus.SCCWRP2k/Desktop/index_comp.png', height = 6, width = 6, res = 400, units = 'in', family = 'serif') | |
p1 | |
dev.off() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment