关于r:使用ggplotly函数转换ggplot图

Converting ggplot graph with ggplotly function

我有一个出色的应用程序,我在其中使用plotly包将ggplot图形转换为动态图形。
我目前遇到这种转换问题。

这是我的data.frame:

1
2
3
4
b <- data.frame(ID_Miseq = c(rep("P1",8), rep("P2",8), rep("P3",8), rep("P4",8)),
Condition1 = c(rep("A", 8), rep("B",16), rep("C", 8)),
Taxon = c(rep(paste0("T",1:8),4)),
Percent = sample(seq(1,25,0.1),32))

当我创建我的静态条形图时,没问题。

1
2
3
4
5
6
library(ggplot2)
gg <- ggplot(b, aes(x = ID_Miseq, y = Percent, fill = Taxon))
gg <- gg + geom_bar(stat ="identity", position ="stack")
factors <-"~Condition1"
gg <- gg + facet_grid(factors, scales ="free", space ="free_x")
gg

Output

但是,当我使用plotly包中的ggplotly函数时,其中一个示例正在变成数字刻度。

1
2
library(plotly)
ggplotly(gg)

enter

有人遇到过同样的问题吗?我使用ggplotly函数是否错误?我正在使用4.7.1


感谢,现在在开发版本中已解决此问题,https://github.com/ropensci/plotly/commit/a0fc9c93e3b64ef4545b3522abbdfe44dc0e81a3

使用devtools::install_github("ropensci/plotly")

安装开发版本