I want to represent the density of a number of variables as you would in a boxplot, violin plot, or beeswarm. But in this case, each variable would be a band with the density displayed as a gradient along the bar.
Hopefully I don't need to manually draw bars as filled shapes.
Imagine if instead of the violins or boxplots, there was a bar with a gradient representing the density.
library(tidyverse)
library(ggplot)
df = data.frame(
A = 2.3 + 7*rnorm(100),
B = 0 + 5*rnorm(100),
C = 4 + 2*rnorm(100)
)
df %>%
gather() %>%
ggplot(aes(x=key, y=value)) +
geom_violin(scale="width", fill='red', alpha=0.5) +
geom_boxplot(fill='green', alpha=0.5)