Bambs
Bambs

Reputation: 567

Converting ggplot graph with ggplotly function

I have got a shiny application where I use the plotly package to convert my ggplot graph into dynamics graphics. I am at the moment facing a problem with this conversion.

Here is my data.frame :

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))

When I am creating my static barplot, no problem.

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 from ggplot2

But, when I am using the ggplotly function from the plotly package, one of the sample is turning into numeric scale.

library(plotly)
ggplotly(gg)

enter image description here

Does anyone have ever faced the same kind of issue ? Am I using the ggplotly function wrong ? I am using plotly 4.7.1

Upvotes: 2

Views: 489

Answers (1)

Carson
Carson

Reputation: 2777

Thanks, this is now fixed in the dev version, https://github.com/ropensci/plotly/commit/a0fc9c93e3b64ef4545b3522abbdfe44dc0e81a3

Install the dev version with devtools::install_github("ropensci/plotly")

Upvotes: 2

Related Questions