функции ggpubr ,ggpp, ggformula не работают с ggplotly

#r #ggplot2 #ggplotly #ggpubr

#r #ggplot2 #ггплотно #ggpubr

Вопрос:

Я использую несколько функций из ggpubr и ggpp для рисования своих графиков. В частности, я использую функции: geom_quadrant_lines() , stat_quadrant_lines() , geom_lm , stat_regline_equation в своем сюжете. Однако, когда я преобразую свой объект ggplot2 в объект с использованием ggplotly() графика , вышесказанное, похоже, не работает. Есть ли какой-нибудь обходной путь? Добавление геометрических фигур в объект plotly также, похоже, не работает

Ниже приведен пример кода и ошибок:

 library(ggplot2) library(plotly) library(ggpubr) library(ggpp) library(ggformula)  set.seed(1234) data lt;- data.frame(x = -5:4   runif(10,-1,1), y = seq(-15,12,3)-runif(10,-1,1)*2) head(data)  g lt;- 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 lt;- ggplotly(g) p  p %gt;% geom_lm(mapping = aes(x=x, y=y), data = data, interval = "prediction", level = 0.95)   

Вывод ggplot2 является вывод ggplot2

После преобразования в объект plotly с помощью ggplotly он становится объект ggplotly

Я также получаю следующие предупреждающие сообщения

 gt; p lt;- 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  

Комментарии:

1. geom_lm кажется, он не откуда и не откуда ggpubr , ggpp насколько я могу судить. Должны ли мы загружать другую библиотеку?

2. Моя вина. пакет ggformula имеет функцию geom_lm. Спасибо, что заметили