-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwnHist.R
36 lines (27 loc) · 1.05 KB
/
wnHist.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
library(tidyverse)
library(viridis)
path <- getwd()
figPath <- paste0(path, '/figures/')
load("wassersteinData.RData")
range(wassersteinData$wn) # 0.06231813 1.01906838
#dat <- dat %>% mutate(rate = as.numeric(gsub(id, pattern='.+r', replacement='')))
#rate.labs <- c(('0.00001 (subs/site/year)'), ('0.001 (subs/site/year)'))
rate.labs <- c("10^-3 (subs/site/year)", "10^-5 (subs/site/year)")
names(rate.labs) <- unique(wassersteinData$rate)
sampProp.labs <- c("p = 0.05", 'p=0.5', 'p=1.0')
names(sampProp.labs) <- unique(wassersteinData$sampProp)
p<- ggplot(wassersteinData) +
geom_histogram(aes(x=abs(wn)), fill='dodgerblue')+
facet_wrap(~rate*sampProp,
labeller = labeller(rate = rate.labs, sampProp=sampProp.labs)) +
xlim(0,1.25) +
theme_minimal() +
xlab(latex2exp::TeX('$W_{N}$')) +
theme(legend.position='none',
legend.title=element_text(size=14),
legend.text=element_text(size=14),
axis.title=element_text(size=14),
axis.text=element_text(size=12))
pdf(paste0(figPath, 'wnHist.pdf'), useDingbats = FALSE, height = 4, width = 6)
p
dev.off()