在软件包`crosstalk'中,是否有函数`bsrows()`and'和'rows+ cols'混合了吗?
在软件包crosstalk
中,有函数bscols()
使绘图连续对齐。但是我找不到函数bsrows()
和行+cols
混合,任何软件包都有这样的函数吗?谢谢!
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)
)
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)
)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我一直在寻找同一件事,直到意识到12是
crosstalk :: bscols()
中的最大列数。这意味着您可以通过为上一个指定widths = 12
将每个小部件都放在下一行上。通过调整宽度,您可以调整两个列以及介绍新行时。这可能不是您所希望的界面,但可以使用。这是一个示例,您的宽度在单独的行上(我添加了htmltools
以使用断裂):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):