R语言 通过bscols排列串扰图

zz2j4svz  于 2023-06-19  发布在  其他
关注(0)|答案(1)|浏览(142)

我试图有一个plotly图和一个plotlyMap连接通过串扰在R。我知道如何控制每个图形的宽度,像这样:

bscols(widths = c(6, 6),
 graph, map)

但我得到了一半大小的输出。如何控制高度?我想有图表和Map全尺寸:从屏幕的顶部到底部。目前,我得到的屏幕的上半部分分裂为两个相等的宽度(6,6)。事实上,我有同样的事情,这是在这本书中提出:
https://plotly-r.com/client-side-linking.html#filter - 第16.2章,图16.9:
图在这里:https://plotly-r.com/interactives/plotly-leaflet-filter.html
代码:

library(leaflet)
library(quakes)

eqs <- highlight_key(quakes)

stations <- filter_slider("station", "Number of Stations", eqs, ~stations)

p <- plot_ly(eqs, x = ~depth, y = ~mag) %>% add_markers(alpha = 0.5) %>% highlight("plotly_selected")

map <- leaflet(eqs) %>%  addTiles() %>% addCircles()

bscols(
widths = c(6, 6, 3), 
 p, map, stations)
voj3qocg

voj3qocg1#

图表的宽度和高度可以在原始的plotly()和leaflet()调用中作为参数传递,然后将这两个对象传递给bscols(),如下所示:
图书馆(传单)图书馆(地震)
eqs <- highlight_key(quakes)
stations <- filter_slider(“station”,“Number of Stations”,eqs,~stations)
p <- plot_ly(等式,x = 〜深度,y = 〜 mag,宽度=“100%",高度= 800)%>% add_marks(alpha = 0.5)%>% highlight(“plotly_selected”)
map <- leaflet(eqs,width =“100%",height = 800)%>% addTiles()%>% addCircles()
bscols(width = c(6,6,3),p,map,stations)

相关问题