title: How to pan and zoom svg file in shiny app
body: <p>I have the shiny app below in which I want to pan and zoom the .svg.</p>
  <pre><code>library(shiny)
  library(DiagrammeR)
  library(tidyverse)
  # probably don't need all of these:
  library(DiagrammeRsvg)
  library(svglite)
  library(svgPanZoom)
  library(rsvg)
  library(V8)# only for svg export but also does not work
  library(xml2)
  
  ui &lt;- fluidPage(
    grVizOutput(&quot;grr&quot;,width = &quot;100%&quot;,height = &quot;90vh&quot;)
  )
  
  server &lt;- function(input, output) {
    
    
    
    reactives &lt;- reactiveValues()
    observe({
      reactives$graph &lt;- render_graph(create_graph() %&gt;%
                                        add_n_nodes(n = 2) %&gt;%
                                        add_edge(
                                          from = 1,
                                          to = 2,
                                          edge_data = edge_data(
                                            value = 4.3)))
    })
    output$grr &lt;-
      renderGrViz(reactives$graph
      )
    
  }
  
  # Run the application
  shinyApp(ui = ui, server = server)
  </code></pre>
  <p>I tried with the <code>svgPanZoom</code> package but could make it work. How does this work? Or an alternative option?</p>
  <pre><code>ui &lt;- fluidPage(
    svgPanZoomOutput(&quot;grr&quot;)
  )
  
  server &lt;- function(input, output) {
    
    
    
    reactives &lt;- reactiveValues()
    observe({
      reactives$graph &lt;- render_graph(create_graph() %&gt;%
                                        add_n_nodes(n = 2) %&gt;%
                                        add_edge(
                                          from = 1,
                                          to = 2,
                                          edge_data = edge_data(
                                            value = 4.3)))
    })
    output$grr &lt;-
      renderSvgPanZoom({
        svgPanZoom(reactives$graph)
        
      })
    
  }
  
  # Run the application
  shinyApp(ui = ui, server = server)
  </code></pre>