I draw a picture using ggplot2 and want to display it in shinyApp with svgPanZoom packages. But the sactters is disappear. Anybody know why? You can run the following code for detail:
library(shiny)
library(svglite)
library(svgPanZoom)
library(ggplot2)
data<-data.frame(x=1:10,y=1:10)
ui <- shinyUI(bootstrapPage(
svgPanZoomOutput(outputId = "main_plot")
))
server = shinyServer(function(input, output) {
output$main_plot <- renderSvgPanZoom({
p <- ggplot(data, aes(x = x, y = y)) + geom_point()
svgPanZoom(p, controlIconsEnabled = T)
})
})
shinyApp(ui,server)
I believe you need to add svglite also
library("svglite")
Then replace svgPanZoom call with this
svgPanZoom(
svglite:::inlineSVG(
show(p)
),
controlIconsEnabled = T
)