Skip to content

Commit

Permalink
add a plot for the defence
Browse files Browse the repository at this point in the history
  • Loading branch information
haganjam committed Nov 28, 2023
1 parent ee652bd commit 6fdb0d4
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 2 deletions.
28 changes: 27 additions & 1 deletion scripts/02_simulation/07_plot_RYE_values.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ p1 <-
plot(p1)

# export as a .svg file
ggsave(filename = "figures/SI2_fig_S2.svg", p1,
ggsave(filename = "figures/SI2_fig_S2.pdf", p1,
unit = "cm", width = 20, height = 14)

# check the range of RYEs for alpha = 3
Expand All @@ -83,4 +83,30 @@ dd_df %>%
summarise(min = min(RYe),
max = max(RYe))

# plot a single one of these with alpha = 3
p2 <-
ggplot(data = dd_df |> dplyr::filter(alpha_3 == "yes"),
mapping = aes(x = Species, y = RYe, group = group)) +
geom_line(alpha = 0.1) +
scale_x_discrete(expand = c(0.05, 0.05)) +
scale_y_continuous(limits = c(0, 1)) +
xlab("Species") +
ylab(bquote("RY"[E])) +
theme_meta() +
theme(
panel.background = element_rect(fill='transparent'), #transparent panel bg
plot.background = element_rect(fill='transparent', color=NA), #transparent plot bg
panel.grid.major = element_blank(), #remove major gridlines
panel.grid.minor = element_blank(), #remove minor gridlines
legend.background = element_rect(fill='transparent'), #transparent legend bg
legend.box.background = element_rect(fill='transparent') #transparent legend panel
)

# export the figure for further modification
ggsave(filename = "figures/def_fig_6.pdf", p2,
unit = "cm", width = 10, height = 8, bg = "transparent")




### END
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ p123 <-
rel_heights = c(1.5, 1, 2))
plot(p123)

ggsave(filename = "figures/MAIN_fig_4.svg",
ggsave(filename = "figures/MAIN_fig_4.pdf",
p123, units = "cm", width = 13, height = 18)

# add a plot for the defence
Expand Down Expand Up @@ -347,6 +347,21 @@ p1 <-
theme_meta()
plot(p1)

# export a plot for the defence
p4_def <-
p1 +
theme(
panel.background = element_rect(fill='transparent'), #transparent panel bg
plot.background = element_rect(fill='transparent', color=NA), #transparent plot bg
panel.grid.major = element_blank(), #remove major gridlines
panel.grid.minor = element_blank(), #remove minor gridlines
legend.background = element_rect(fill='transparent'), #transparent legend bg
legend.box.background = element_rect(fill='transparent') #transparent legend panel
)

ggsave(filename = "figures/def_fig_2.pdf", p4_def,
unit = "cm", width = 10, height = 8, bg = "transparent")

slope_sum <-
lm_df %>%
summarise(slope_m = mean(slope),
Expand Down

0 comments on commit 6fdb0d4

Please sign in to comment.