By Data Tricks, 5 September 2019
library(plotly) set.seed(135) #Create some simulated data data <- data.frame(Value = round(rnorm(n=100000, mean=100, sd=20),0), Category = sample(c(1:2),100000,replace=TRUE)) data$Category <- as.character(data$Category) #Basic violin plot p <- plot_ly(data, y=~Value, type='violin', x0 = 'Label') %>% layout(yaxis = list(title = "Label")) %>% config(displayModeBar = F) print(p)
Please note that your first comment on this site will be moderated, after which you will be able to comment freely.
You might also like
Violin plot in ggplot2
Create violin plots in R with the ggplot2 package.
3D world map with plotly
Quickly plot data on a 3D world map with the plotly package for R.
Access more for free
Access more articles and code for free