Hi I want to create a similar chart as shown below with R script:
taken from: https://community.tableau.com/thread/194440
this is my code in R :
A good example where ggstance package comes in handy.
ggstance
library(ggplot2) library(ggstance) ggplot(iris, aes(x = Sepal.Length)) + geom_histogram() + geom_boxploth(aes(y = 3), width = 2, color = "blue", lwd = 2, alpha = .5) + theme_minimal() + facet_wrap(~Species, ncol = 1)