In package crosstalk
, there is function bscols()
make plots align in a row. But I cant't find function bsrows()
and rows+cols
mixed , is any package have such function? Thanks!
library(plotly)
library(tidyr)
library(crosstalk)
m <- gather(mtcars, variable, value, -vs)
msd <- highlight_key(m, ~variable)
gg <- ggplot(msd, aes(factor(vs), value)) +
geom_jitter(alpha = 0.3)
bscols(
widths = c(11, 6, 6),
filter_select("id", "Select a variable", msd, ~variable, multiple = FALSE),
ggplotly(gg, dynamicTicks = "y") %>% layout(margin = list(l = 30)),
plot_ly(msd, x = ~jitter(vs), y = ~value) %>% add_markers(alpha = 0.3)
)
I was searching for the same thing until realizing that 12 is the maximum number of columns in
crosstalk::bscols()
. This means that you can put every widget on next row just by specifyingwidths = 12
for the previous one. By adjusting widths you can adjust both columns and when new rows are introduces. It is probably not the interface you were hoping for but it works. Here is an example with your widgests on separate rows (I addedhtmltools
to use breaks):