garthtarr / edgebundleR

Circle plot with bundled edges
http://garthtarr.github.io/edgebundleR/
66 stars 12 forks source link

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

Open EhsonGhandehari opened 6 years ago

EhsonGhandehari commented 6 years ago

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) })

garthtarr commented 6 years ago

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)
EhsonGhandehari commented 6 years ago

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.

garthtarr commented 6 years ago

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)
timelyportfolio commented 6 years ago

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

EhsonGhandehari commented 6 years ago

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.