Mazzy Mazzy - 1 month ago 12x
R Question

Print box plot in R with plotly

I'm using plotly to create plots and I'm trying to create a box plot with the following data

data = data.frame(conn_1000 = c(970.09, 384, 1495), conn_2000 = c(970.09, 384, 1495), conn_4000 = c(1042.72, 685, 1495), conn_6000 = c(1012.92, 68, 1482))

plot_ly(y = data, type = "box")

As result I get an empty plot. Do you know where is the mistake?


You can try to melt your data and add group and y

because you need data in long format, but now you have in wide

plotly::plot_ly( data=reshape2::melt(data), type = "box",group = variable,y=value)

enter image description here