# install.packages("ggplot2", dependencies=TRUE) library(ggplot2) DATA <- read.csv(file.choose(), header=TRUE) DATA$FACET <- factor(DATA$FACET, levels=c("White respondents", "Black respondents")) DATA$ITEM <- factor(DATA$ITEM , levels=rev(c("White defendant", "Black defendant"))) ggplot(DATA, aes(PE, ITEM)) + geom_rect(data=NULL,aes(xmin=-Inf, xmax=0, ymin=-Inf, ymax=Inf), fill="lightsteelblue3") + geom_point(size=3) + geom_errorbarh(aes(xmin=CILO, xmax=CIHI), height=0, size=0.75) + facet_wrap(~FACET, ncol=2, dir="v") + geom_vline(xintercept=0) + scale_x_continuous(name="Mean sentence length", breaks=seq(0,25,5), labels=scales::number_format(accuracy=1), expand=c(0,0), limits=c(0,25)) + labs(caption="Error bars are 83.4% confidence intervals. Data source: Rice et al. 2021 JOP.\n'Same As It Ever Was? The Impact of Racial Resentment on White Juror Decision-Making'.") + theme( plot.background = element_rect(fill="white"), plot.margin = unit(c(0.5,0.5,0.5,0.5),"cm"), plot.title = element_text(face="bold", margin=margin(t=0, b=12), size=16, hjust=0.5), plot.subtitle = element_text(size=12, hjust=0.5), plot.caption = element_text(size=9, hjust=1), strip.background = element_rect(color="black", fill="black"), strip.text.x = element_text(size=14, color="white", face="bold"), panel.background = element_rect(fill="lightsteelblue2", color="black", size=0.5, linetype="solid"), panel.border = element_rect(fill=NA, color="black", linetype="solid", size=1.5), panel.grid.major.x = element_blank(), panel.grid.major.y = element_blank(), panel.grid.minor.x = element_blank(), panel.grid.minor.y = element_blank(), panel.spacing.x = unit(2, "lines"), panel.spacing.y = unit(1, "lines"), axis.text.x = element_text(size=12, color="black", margin=margin(t=7, b=5)), axis.text.y = element_text(size=12, color="black", margin=margin(r=7)), axis.ticks.y = element_blank(), axis.ticks.x = element_blank(), axis.title.y = element_blank(), axis.title.x = element_text(size=12, color="black")) ggsave(file="D:/plots/Umass Length by Race.svg", width=7, height=3)