I want a boxplot to be overlayed on histogram. to avoid missing with the histogram, I am forced to draw the boxplot like that:
library(ggplot2)
ggplot(iris) + geom_boxplot(aes(x = Sepal.Length, y = factor(0)))
However the plot doesn't appear right unless I swap between the x and y.
I want to integrate a histogram with boxplot on the same coordinate, but it seems there is no way to plot a boxplot flipped without using coord_flip()
that doesn't help here as it flip the whole plot.
ggplot(iris) +
geom_histogram(aes(x = Sepal.Length))+
geom_boxplot(aes(x = Sepal.Length, y = factor(0))) +
coord_flip()