ShinyApp中的R svgPanZoom在Web和Rstudio中的显示方式有所不同 [英] R svgPanZoom within shinyApp display different in the Web and Rstudio

查看:187
本文介绍了ShinyApp中的R svgPanZoom在Web和Rstudio中的显示方式有所不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用带有svgPanZoom,svglite,ggplot2和闪亮包的R画了一幅画.但是,它可以在Rstudio上正确显示,但不能在Web上正确显示.有解决方案吗?请运行以下代码以获取详细信息.

I draw a picture using R with packages svgPanZoom,svglite,ggplot2 and shiny. However, it can display correctly on Rstudio but not on Web. Are there any options to solve it? Please run the following code for detail.

library(shiny)
library(svglite)
library(svgPanZoom)
library(ggplot2)

data<-data.frame(x=1:50,y=1:50)
x_position<-1:50
y_position<-1:50
ui <- pageWithSidebar(
  headerPanel(""),
  sidebarPanel(),
  mainPanel(

    column(width=12,svgPanZoomOutput(outputId = "main_plot",width=600,height=450))

))

server = shinyServer(function(input, output) {
  output$main_plot <- renderSvgPanZoom({
    p <- ggplot(data, aes(x = x, y = y)) + geom_point()

    svgPanZoom(
      svglite:::inlineSVG(show(p))
      , controlIconsEnabled = T)
  })
})

shinyApp(ui,server)

R工作室:

网站:

推荐答案

最后,我尝试使用"SVGAnnotation"包并幸运地解决了该问题.

Finally, I try the package "SVGAnnotation" and fortunately solved the problem.

这篇关于ShinyApp中的R svgPanZoom在Web和Rstudio中的显示方式有所不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆