I have created a table of beta coefficients from three models. The models are estimating selection for different landcover types and differ only by time period. How can I create a figure that looks similar to this . Orange and green represent the different landcover types.
Here is the code I used to create the graph for one model's betas:
ggplot(betas_midday, aes(Variable, Estimate)) +
geom_point() +
geom_errorbar(aes(ymin=Estimate-CI, ymax=Estimate+CI), width=.2, position=position_dodge(.9)) +
geom_hline(yintercept=0, linetype="dashed", color="red", size=0.5) + ylim(-0.6,1.3) +
ggplot2::annotate('text', x=2.4, y=0, label="Brush", size = 10) + annotate('text', x=2.4, y=1.2, label="Midday", size = 15) +
labs(y='Selection', x='Landcover Type') +
theme(axis.text=element_text(size=30),axis.title=element_text(size=30,face="bold"),plot.title = element_text(size=24, hjust = 0.5)) +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"))
Here is my data:
structure(list(Variable = c("mottes", "root-plowed", "mottes",
"root-plowed", "mottes", "root-plowed"), Time_period = c("midday",
"midday", "night", "night", "crepuscular", "crepuscular"), Estimate = c(0.112762883871621,
0.978136075960821, 0.330800972033945, -0.274796168643408, 0.39961563211462,
-0.216926744117051), SE = c(0.19717904127417, 0.126627496764976,
0.152794807096571, 0.155299309443016, 0.121171489524617, 0.0985049367369206
), `z value` = c(0.571880678306114, 7.72451561430032, 2.16500140495527,
-1.76946162625559, 3.29793447024876, -2.20219159874598), `Pr(>|z|)` = c(0.567402814817547,
1.12279478002282e-14, 0.0303875776790643, 0.0768168691956359,
0.000973988621992874, 0.0276517772569329), CI = c(0.386470920897372,
0.248189893659353, 0.299477821909279, 0.30438664650831, 0.237496119468249,
0.193069676004364)), row.names = c("land_typemottes", "land_typeroot-plowed",
"land_typemottes1", "land_typeroot-plowed1", "land_typemottes2",
"land_typeroot-plowed2"), class = "data.frame")
library(ggplot2)
transform(betas_midday, Time_period = factor(Time_period, c("midday", "night", "crepuscular"))) |>
ggplot(aes(Time_period, Estimate, color = Variable, group = Variable)) +
geom_point(position=position_dodge(.9)) +
geom_errorbar(aes(ymin=Estimate-CI, ymax=Estimate+CI), width=.2, position=position_dodge(.9)) +
geom_hline(yintercept=0, linetype="dashed", color="red", size=0.5) + ylim(-0.6,1.3) +
annotate('text', x=2.4, y=0, label="Brush", size = 10) + annotate('text', x=2.4, y=1.2, label="Midday", size = 15) +
labs(y='Selection', x='Landcover Type') +
theme(axis.text=element_text(size=30),axis.title=element_text(size=30,face="bold"),plot.title = element_text(size=24, hjust = 0.5)) +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"))