-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPanel figure using cowplot.R
More file actions
51 lines (37 loc) · 1.65 KB
/
Panel figure using cowplot.R
File metadata and controls
51 lines (37 loc) · 1.65 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
## Install packages ----
install.packages(c("cowplot", "ggplot2"))
lapply(c("cowplot", "ggplot2"),
library, character.only = T)
#------- create a panel panel using cowplot
## format aesthetics
require(cowplot)
require(ggthemes)
theme_set(theme_classic(base_size = 16))
cbPalette <- c("#999999", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7")
annualTransectBiomassFig_HIRMD <- ggplot(sum_annual1,
aes(Site.x, transectBiomass)) +
geom_boxplot(aes(fill=Site.x), size=1) +
theme(panel.grid.major = element_line(colour = "grey90", linetype = 3)) +
scale_fill_manual(values = cbPalette) +
facet_wrap(~species, ncol=1) +
ylab("Biomass (g DW) / 20"~m^{2}) +
xlab("") +
theme(axis.text=element_text(size=12))+
theme(legend.position="none")+
theme(plot.title = element_text(hjust = -0.01, vjust=1.12, size =20))
annualTransectBiomassFig_HIRMD
annualTransectBiomassFig<- ggplot(sum_annual1,
aes(Site.x, transectBiomass)) +
geom_boxplot(aes(fill=Site.x), size=1) +
theme(panel.grid.major = element_line(colour = "grey90", linetype = 3)) +
scale_fill_manual(values = cbPalette) +
facet_wrap(~species, ncol=1) +
ylab("Biomass (g DW) / 20"~m^{2}) +
xlab("Site") +
theme(axis.text=element_text(size=12))+
theme(legend.position="none")+
theme(plot.title = element_text(hjust = -0.01, vjust=1.12, size =20))
annualTransectBiomassFig_HIRMD
#print multiple figures using cowplot
annualFig_HIRMD <- plot_grid(annualTransectBiomassFig_HIRMD,annualTransectBiomassFig,
labels = c('A', 'B', size=20), ncol=2)