Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
EhsonGhandehari opened this issue Jan 17, 2018 · 5 comments

Comments

@EhsonGhandehari
Copy link

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
Copy link
Owner

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
Copy link
Author

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
Copy link
Owner

garthtarr commented Jan 21, 2018

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
Copy link
Contributor

guessing d3v3 from edgebundler conflicting with d3v4 from networkD3. See christophergandrud/networkD3#162 for discussion but no resolution.

@EhsonGhandehari
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants