Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set.seed(1)
- df <- data.frame(cluster=rep(LETTERS[1:10],2),group=c(rep("A",10),rep("B",10)),point=rnorm(20),err=runif(20,0.1,0.3))
- df$group <- factor(df$group,levels=c("A","B"))
- library(plotly)
- plot_ly(x=~df$cluster,y=~df$point,split=~df$group,type='scatter',mode="markers",showlegend=T,color=~df$group) %>%
- layout(legend=list(orientation="h",xanchor="center",x=0.5,y=1),xaxis=list(title=NA,zeroline=F,categoryorder="array",categoryarray=sort(unique(df$cluster)),showticklabels=T),yaxis=list(title="Val",zeroline=F)) %>%
- plotly::add_trace(error_y=list(array=df$err),showlegend=F)
Add Comment
Please, Sign In to add comment