graph - subplot in R plotly with bar diagram -


i have problem reproducing ggplot diagram plotly. have evolutions decomposed in 5 components (effet) bunch of sectors (a17). bar diagram each sector, put evolution of sector side side. here's subset of data :

t <- structure(list(a17 = c("fz", "gz", "fz", "gz", "fz", "gz", "fz",  "gz", "fz", "gz"), effet = c("effetaugmentation", "effetaugmentation",  "effetdiminution", "effetdiminution", "effetentreea17", "effetentreea17",  "effetsuppression", "effetsuppression", "effetnouveaux", "effetnouveaux" ), value = c(4133.836, 5765.367, -1511.959, -1625.793, 76, 137,  -88, -247, 606, 748)), class = c("tbl_df", "tbl", "data.frame" ), row.names = c(na, -10l), .names = c("a17", "effet", "value")) 

and here's ggplot, :

ggplot(t,aes(x=1,y=value,fill=effet)) +geom_bar(stat="identity",position="dodge")+facet_wrap(~a17) 

with plotl_ly, can make 1 graph :

plot_ly(t,x=~effet,y=~value,type="bar",split=~effet) 

but if try facet, things go wrong. try :

t <-t %>% mutate(id = dense_rank(a17)) p <-plot_ly(t,x=~effet, y=~value,type="bar",split=~effet,xaxis=paste0("x",~id)) subplot(p,nrows=3)  

but graph make no sense.

any appreciated !

edit : update syntax plotly 4.5, still doesn't work


Comments