I'm plotting two violin plots for comparison (over time) with plotly. Everything is working fine so far - but now I was asked to overlay both violin plots (for better comparison). For the sake of my life, it seems I'm not capable of getting it to work! They will always end side beside side.
Has anyone faced a similar challenge?
library(plotly) library(dplyr) df_test <- data.frame(side=rep(c("left","right"), 100), daysPassed=c(sample(1:100, 200, replace=T)), month=c(rep(201601,20),rep(201602,20),rep(201603,20),rep(201604,20),rep(201605,20),rep(201606,20),rep(201607,20),rep(201608,20),rep(201609,20),rep(201610,20)) ) df_test %>% plot_ly( x = ~side, y = ~daysPassed, frame = ~month, split = ~side, type = 'violin', points = F, spanmode = "hard", showlegend = F, box = list( visible = F ), meanline = list( visible = T ) ) %>% layout( yaxis = list(range = c(0, max(df_test$daysPassed, na.rm=T)), title = "Days Passed", zeroline = T, autorange = F), xaxis = list( title = "", showticklabels = TRUE ) )