Hi,
I'm attempting to recreate something like the plot here. I'd like the strip label to be left aligned along with the plot title, but left justifying the label cuts it off (as in the example below). As always, I appreciate the help.
suppressWarnings(suppressPackageStartupMessages(library(tidyverse)))
convicted <- c(0.68, 0.33)
incarcertated <- c(0.48, 0.12)
group <- c("GENERAL POPULATION", "LAW ENFORCEMENT")
df <- data.frame(convicted, incarcertated, group) %>%
pivot_longer(c(convicted, incarcertated),
names_to = "status", values_to = "value")
df %>%
ggplot(aes(x=value, y=status, fill=group)) +
facet_wrap(~group, ncol=1) +
geom_col(width = .33) +
scale_fill_manual(values=c("#058cd3", "#ff2700")) +
geom_col(aes(x=1, y=status),
alpha = .1,
fill = "#aaaaaa",
width = .33) +
geom_text(aes(label=round(100*value)), hjust=-0.5) +
labs(title = "What Percentage of Crimininal Defendants Are\nConvicted and Incarcerated?",
subtitle = "Felony defendents in the general population, (2006) vs.\nlaw enforcement officers accused of misconduct (2009-10)"
) +
theme_minimal() +
theme(legend.position = "none",
panel.grid = element_blank(),
axis.title = element_blank(),
axis.text.x = element_blank(),
plot.title.position = "plot",
strip.text.x = element_text(hjust = -0.02))
Created on 2021-11-30 by the reprex package (v2.0.0)