I have a Shiny app with many interactive plots. These are ggplots that are rendered as interactive using ggplotly
. I want to save these interactive plots as static SVG plots, and I cannot simply save the original ggplot version using ggsave
because those plots are heavily modified aesthetically to get the final interactive plot just right.
It seems that orca
is built for this, but....
library(ggplot2)
library(plotly)
#Plot with ggplot
p <- ggplot(mtcars, aes(x=mpg, y=cyl)) + geom_point()
#Convert it into interactive plot
p2 <- ggplotly(p)
#Use orca to stave interactive plotly object as static SVG
orca(p2, "p2_plot.svg")
I get this error when trying:
Error: The orca command-line utility is required for this functionality.
Please follow the installation instructions here -- https://github.com/plotly/orca#installation
I took a look into the documentation, and it seems a little involved to get this installed. If I am able to successfully get this installed, will this still work in Shiny? I am deploying to a shinyapps.io site, but this isn't just a library like everything else in the app.
Or alternatively, is there a better way going about this?