Adding a side boxplot to an existing side beeswarm plot

72 Views Asked by At

I created a side beeswarm plot with a sample data set using the following code:

x <- rnorm(300)
beeswarm(x, pch = 19, 
         col = c("black"),
         side = 1)

This is the plot I got.

Beeswarm Plot.

I'm trying to add a boxplot with the data to the left side of this beeswarm plot.

So far, I've tried using the gghalves and ggbeeswarm package to add a half boxplot to the beeswarm plot, but this ruins the distribution of the dots from the beeswarm. The dots end up looking cluttered rather than a nice distribution as shown in the picture above. Is there a way to keep the distribution of the beeswarm dots and just add a boxplot to the side of the plot? I'm trying to create a plot that looks like this one.

Nature Plot

0

There are 0 best solutions below