I am using a few functions from ggpubr and ggpp to draw my plots.
Specifically, i am using the functions: geom_quadrant_lines()
, stat_quadrant_lines()
, geom_lm
, stat_regline_equation
in my plot.
However, when i convert my ggplot2 object into a plotly object using ggplotly()
, the above dont seem to be working.
Is there any workaround? Adding the geoms to the plotly object also dont seem to work
Example Code and Errors Below:
library(ggplot2)
library(plotly)
library(ggpubr)
library(ggpp)
library(ggformula)
set.seed(1234)
data <- data.frame(x = -5:4 + runif(10,-1,1), y = seq(-15,12,3)-runif(10,-1,1)*2)
head(data)
g <- ggplot(data = data, aes(x=x, y=y)) +geom_point() +
stat_mean(color = "blue") +
geom_quadrant_lines()+
stat_quadrant_counts()+
stat_regline_equation( formula = y~x, aes(label = paste( ..eq.label.., ..adj.rr.label.., sep="~~")),output.type="expression", label.y.npc = 0.8, label.x.npc = 0.0, colour="black", size = 2.5) +
labs(title= "Example Plot") + #change the number of days here
geom_lm(interval = "prediction", level = 0.95)
g
p <- ggplotly(g)
p
p %>% geom_lm(mapping = aes(x=x, y=y), data = data, interval = "prediction", level = 0.95)
Once converted into plotly object using ggplotly, it becomes
I also get the below warning messages
> p <- ggplotly(g)
Warning messages:
1: In geom2trace.default(dots[[1L]][[1L]], dots[[2L]][[1L]], dots[[3L]][[1L]]) :
geom_GeomQuadrantLines() has yet to be implemented in plotly.
If you'd like to see this geom implemented,
Please open an issue with your example code at
https://github.com/ropensci/plotly/issues
2: In geom2trace.default(dots[[1L]][[1L]], dots[[2L]][[1L]], dots[[3L]][[1L]]) :
geom_GeomTextNpc() has yet to be implemented in plotly.
If you'd like to see this geom implemented,
Please open an issue with your example code at
https://github.com/ropensci/plotly/issues
3: In geom2trace.default(dots[[1L]][[1L]], dots[[2L]][[1L]], dots[[3L]][[1L]]) :
geom_GeomLm() has yet to be implemented in plotly.
If you'd like to see this geom implemented,
Please open an issue with your example code at
https://github.com/ropensci/plotly/issues