使用带有构面的ggplot2从R创建html5交互式图(作图)

时间:2019-09-11 03:42:39

标签: r ggplot2 plot plotly ggplotly

我可以通过ggplot2轻松转换由plotly::ggplotly()创建的图,如下所示:

library(tidyverse)
ggplot(as_tibble(iris), aes(x=Sepal.Width, y=Petal.Length, color=Species)) + geom_point()
plotly::ggplotly()

enter image description here

我希望下面的方法能够起作用,以使点出现在图形的每个面上。

ggplot(as_tibble(iris), aes(x=Sepal.Width, y=Petal.Length)) + facet_wrap(~Species)+ geom_point()
plotly::ggplotly()

ggplot2情节:

enter image description here

转换为:

enter image description here

因此它不起作用,仅返回没有点的正确切面的轴。

有解决方法吗?

版本:

R 3.6.1 
RStudio 1.2.1335
tidyverse 1.2.1
ggplot2 3.2.1
tibble  2.0.1
plotly 4.9.0

0 个答案:

没有答案