How can I add a space or break between every second label on the x-axis in ggplot, to introduce some distance between each set of platforms (FB, IG, and TW)?
If I try adding blank rows to the dataframe, ggplot drops them (even after adding drop=FALSE to scale_x_discrete).
I also do not want to fix this by saving the figure larger (because there are more variables than what I include here).
Here is the code:
Platform <- c("FB Left-wing", "FB Right-wing",
"IG Left-wing", "IG Right-wing",
"TW Left-wing", "TW Right-wing")
Ideology <- c("Left", "Right", "Left", "Right","Left", "Right")
CI_low <- c(1.049, 0.906, 1.212, 0.989, 1.122, 1.080)
CI_high <- c(1.299, 1.144, 1.483, 1.235, 1.362, 1.335)
CI_mid <- c(1.167, 1.018, 1.340, 1.105, 1.236, 1.201)
dat_figure <- data.frame(Platform, Ideology, CI_low, CI_high, CI_mid)
figure <- ggplot(dat_figure, aes(x = Platform, y = CI_mid, colour = Ideology)) +
scale_colour_manual(values = c("blue", "red")) +
geom_pointrange(aes(ymin = CI_low, ymax = CI_high)) +
ylim(0, 4) +
ylab("Odds Ratio") +
xlab("Platform and Ideology") +
theme_bw()
figure
And the output:
I would like to add a space between 'FB Right-wing and IG Left-wing', and 'IG Right-wing and TW Left-wing'.
Thanks.