# pdf("E:R-Burge4.pdf", width=4.5, height=6) # win.metafile("E:R-Burge4.wmf", width=4.5, height=6) # svg(filename="E:R-Burge4.svg", width=4.5, height=6, pointsize=20) # install.packages("ggplot2", dependencies=TRUE) library(ggplot2) DATA <- read.csv(file.choose(), header=TRUE) DATA$OUTCOME <- factor(DATA$OUTCOME, levels=c("Willingness to vote for", "Likelihood of receiving the Black vote", "Ability to represent interests")) DATA$TARGET <- factor(DATA$TARGET, levels=rev(c("Light Julie", "Dark Julie", "Light James", "Dark James"))) plot <- ggplot(DATA, aes(COEFF, TARGET)) + geom_point(size=2.5) + geom_errorbarh(aes(xmin=CILO, xmax=CIHI), height=0, size=0.75) + facet_wrap(~OUTCOME, ncol=1, dir="v") + geom_vline(xintercept=0) + scale_x_continuous(name="Outcome variable on a 100-point scale", breaks=seq(50,80,5), labels=scales::number_format(accuracy=1), expand=c(0,0), limits=c(50,80)) + labs(caption="Data source: Burge et al. 2020 JOP.\nError bars are 83% confidence intervals.") + 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=13), size=13, hjust=0.5), plot.subtitle=element_text(hjust=0.5), plot.caption=element_text(hjust=1), strip.background=element_rect(color="black", fill="black"), strip.text.x=element_text(color="white", face="bold", size=11), 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.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.spacing.x=unit(0.5, "lines"), axis.title.y=element_blank(), axis.title.x=element_text(size=9, color="black"), axis.ticks.y=element_blank(), axis.ticks.x=element_blank(), axis.text.x=element_text(color="black"), axis.text.y=element_text(color="black")) plot # dev.off()