plotly::ggplotly support
dgrapov opened this issue · 1 comments
dgrapov commented
Great work!
It would be awesome to be able to output the edited plot to ggplotly.
e.g. quick and dirty hack of the plot.ggedit
library(ggedit)
library(ggplot2)
library(dplyr)
library(plotly) # * 3.6.0
get_ggedit<-function(obj){
if(!is.null(obj$UpdatedPlots)) obj=obj$UpdatedPlots
numPlots = length(obj)
pp<-obj[[1]]
if(length(obj)>1){
for (i in 2:numPlots) {
pp<-pp + obj[[i]]
}
}
return(pp)
}
p<-ggplot(data=iris,aes(x =Sepal.Length,y=Sepal.Width))+
geom_point(aes(color=Species),size=6)
ggedit(p) %>%
get_ggedit(.) %>%
ggplotly(.)
yonicd commented
Interesting idea.
but you are assuming 1 plot.
plot.ggedit is built for layouts of a list of plots using viewport and vplayout. This isn't possible with ggplotly yet I think.
It would be easier to just do p1$updatedPlots[[j]]%>%ggplotly
p1 ggedit output
j index in input list