简体   繁体   中英

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)

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM