plotly.R
plotly.R copied to clipboard
Wrong order of layers from ggplot
The output that I get from ggplot is

and from plotly is

With plotly, the boxplot is behind the violim chart.
The minimal working example that create the above images:
library(tidyverse)
library(plotly)
figure2b <-
iris |>
ggplot(aes(x=Species, y=Petal.Length)) +
geom_violin(aes(fill=Species)) +
geom_boxplot(width = 0.05) +
labs(
title='Iris',
x="Species",
y="Petal length",
)
figure2b_plotly <- ggplotly(figure2b)