I would like to make my ggplot graphics more dense, but Ic cant get an idea how to do this (except to coorect in via paint later).
This is what ggplot gives me:
This is what I would like it to look like:
Someone knows how to achieve this in ggplot?
Thank you.
CodePudding user response:
The simplest way I know of is to simply trade-off the boxplot's width with the aspect ratio in the theme. Below, I used a build-in dataset to roughly mimick your plot.
library(ggplot2)
p <- ggplot(subset(iris, Species != "setosa"),
aes(Sepal.Length, Species))
p geom_boxplot(width = 0.25)
p geom_boxplot(width = 0.5)
theme(aspect.ratio = 0.5)
Created on 2022-04-21 by the reprex package (v0.3.0)