1: Facet a plot_ly
chart using the do()
and subplot()
method:
library(plotly)
iris%>%
group_by(Species) %>%
do(p=plot_ly(., x = ~Sepal.Length, y = ~Sepal.Width, color = ~Species, type = "scatter")) %>%
subplot(nrows = 1, shareX = TRUE, shareY = TRUE)
2: Trellis a plot_ly
chart using the new dplyr::group_map()
function.
library(dplyr)
iris%>%
group_by(Species) %>%
group_map(~ plot_ly(data=., x = ~Sepal.Length, y = ~Sepal.Width, color = ~Species, type = "scatter", mode="markers"), keep=TRUE) %>%
subplot(nrows = 1, shareX = TRUE, shareY=TRUE)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…