用連結視圖做摘要
有些圖層在繪圖前會在背景先計算統計摘要,例如直方圖與盒狀圖。因此,如果你把盒狀圖與其他圖表連結,盒狀圖會根據所選取的點進行更新。在這個練習中,你會把「總推力」對「LEO 載重能力」的散佈圖,同時連結到盒狀圖與直方圖,來觀察這種行為。
本練習屬於課程
R 的 plotly 互動式資料視覺化:中級
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# SharedData object allowing selection of observations
shared_obs <- SharedData$new(lv2000)
# Scatterplot of to_thrust against leo_capacity
scatter <- shared_obs %>%
plot_ly(x = ~leo_capacity, y = ~to_thrust) %>%
add_markers()
# Create a boxplot of to_thrust
box <- shared_obs %>%
___(y = ___) %>%
___(name = "overall")
# Link the two plots
subplot(___, ___) %>%
___() %>%
___(on = ___)