More code than you really need, but to set the mood:
#Make some data and load packages
data<-data.frame(pchange=runif(80,0,1),group=factor(sample(c(1,2,3),80,replace=T)))
library(dplyr)
library(magrittr)
library(gridExtra)
library(ggplot2)
data%<>%arrange(group,pchange) %>% mutate(num=1:80)
#Make plot that includes unicode characters
g1<-ggplot(data, aes(factor(num),pchange, fill = group,width=.4)) +
geom_bar(stat="identity", position = "dodge") +
theme_classic()+
theme(axis.ticks = element_blank(),
axis.text.x = element_blank(),
legend.position="right")+
scale_y_continuous(breaks=c(0,.25,.5,.75,1))+
xlab("")+
scale_fill_discrete("Arbitrary Group",
breaks=c(1,2,3),
labels=c("< 1 Year", "\u2265 1 Year & \n\u2264 5 Years","> 5 Years"))
#I want to add an A below the plot (this may not be necessary for the issue, but its a part of the workflow so I thought I'd include it.
g <- arrangeGrob(plot=g1,
sub = textGrob("A",
x = .1,
hjust = .5,
vjust=-2,
gp = gpar(fontface = "bold",
fontsize = 16,
col="black")))
#Save the plot
ggsave(filename="X:/yourpath/Plot1.pdf", plot=g,
width = 8, height = 4, units = "in", dpi = 600)
Here's what it looks like:
Here's what it should look like (in terms of the characters in the key; plot taken as jpeg directly from Rstudio plot window):