edgebundleR icon indicating copy to clipboard operation
edgebundleR copied to clipboard

Circle plot can be created in R console, but it does not show up in Shiny app.

Open EhsonGhandehari opened this issue 7 years ago • 5 comments

Hi. I am able to create circle plots in R console, but for some unknown reason, I am not able to present the circle plot in my Rshiny app. I even tried to reproduce the "shinyedge" function in my app, but the plot does not show up. The app does not through any error, it just does not show the plot.

here is a piece of my code:

UI side: tabPanel(title="CirclePlot",value="CP",
fluidRow( column(3, sliderInput("tension", "Tension", 0.3,min=0,max=1,step = 0.01), sliderInput("fontsize","Font size",12,min=6,max=24), sliderInput("width","Width and height",600,min=200,max=1200), sliderInput("padding","Padding",100,min=0,max=300), downloadButton("export",label="Download")), column(9, uiOutput("circplot") )))

Server:

output$circplot <- renderUI({
  edgebundleOutput("eb", width = input$width, height=input$width)
})

output$eb <- renderEdgebundle({ edgebundle(values$spp,tension=input$tension,cutoff=input$cutoff, fontsize=input$fontsize,padding=input$padding) })

EhsonGhandehari avatar Jan 17 '18 20:01 EhsonGhandehari

Can you make the above example reproducible? E.g. use a toy dataset.

To check, this doesn't work for you?

library(igraph)
ws_graph = watts.strogatz.game(1, 50, 4, 0.05)
shinyedge(ws_graph)

garthtarr avatar Jan 20 '18 20:01 garthtarr

Hi. Thanks for reply. I am able to reproduce the aforementioned code in R. I did take a look at the shinyedge.R code on GitHub, and I wrote my code, considering the shinyedge.R as a reference. But still I am not able the create the plot in a Tabpanel.

EhsonGhandehari avatar Jan 21 '18 05:01 EhsonGhandehari

Could you share a reproducible example, using a toy data set (instead of values$spp) and use the app.R file format so I can copy and paste into R? A skeleton is below.

library(edgebundleR)
library(shiny)

server <- function(input, output) {

  output$circplot <- renderUI({
    ##
  })

  output$eb <- renderEdgebundle({
    ##
  })
}

ui <- fluidPage(
  sidebarLayout(
    sidebarPanel(
      ##
    ),
    mainPanel(
      ##
    )
  )
)

shinyApp(ui = ui, server = server)

garthtarr avatar Jan 21 '18 21:01 garthtarr

guessing d3v3 from edgebundler conflicting with d3v4 from networkD3. See https://github.com/christophergandrud/networkD3/issues/162 for discussion but no resolution.

timelyportfolio avatar Jan 21 '18 23:01 timelyportfolio

Hi. Thanks for the replies. I noticed that the issue is caused by tabPanel in Shiny environment. I had a Tabset with 5 tabPanels. I used the edgebundleR package for creating the circle plot in the 5th tabPanel. I noticed that the plot did not render, but I was able to save the plot by clicking on a Download button (code was similar the Shinyedge.R code).

I added another tabPanel (6th tabpanel), plotting another graph. After that, I noticed that the circleplot in the 5th TabPanel rendered (the graph was presented), but the plot in 6th panel did not show up.

Therefore, I do not think the issue is caused by "edgebundleR" package.

EhsonGhandehari avatar Jan 25 '18 01:01 EhsonGhandehari