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

R plot output #13

Closed
rb643 opened this issue Jul 19, 2021 · 4 comments
Closed

R plot output #13

rb643 opened this issue Jul 19, 2021 · 4 comments

Comments

@rb643
Copy link

rb643 commented Jul 19, 2021

Could not find a R specific repo so apologies for posting here.

I'm trying to integrate the dtw twoWay plot into a shiny dashboard but unfortunately keep getting API errors/mismatches when using renderPlot to get the output to a window. I assume this is because the dtw plot output is different from base or ggplot outputs and so I was curious if there is any way around this (rather then me trying to reinvent the plotting function into ggplot somehow..)

@tonigi
Copy link
Collaborator

tonigi commented Jul 19, 2021 via email

@rb643
Copy link
Author

rb643 commented Jul 19, 2021

Will dig into that, but if its already in base why wouldn't this work:
Running this on the server side

#server.r
output$dtwgen <- reactive({
    fits <- data[,input$select]

    out <- dtw(fits$t1,fits$t2,keep=TRUE)
    return(out)
    
  })
  
  output$dtw_plot <- renderPlot({
    out <- dtwgen()
    dtwPlotTwoWay(out)
  })
  

With this on ui.r side

tabPanel(
          title = "Dynamic Time Warp",
          withSpinner(
            plotOutput("dtw_plot"),
            type = 4,
            color = "#d33724",
            size = 0.7
          )
        )

Generates this...

Warning: Error in Cairo: Graphics API version mismatch
  129: Cairo
  128: <Anonymous>
  126: startPNG
  125: drawPlot
  111: <reactive:plotObj>
   95: drawReactive
   82: renderFunc
   81: output$dtw_plot_male
    1: runApp

@tonigi
Copy link
Collaborator

tonigi commented Jul 19, 2021

Graphics API version mismatch seems some technical quibble. In any case, the two-way plot is essentially out$index1 vs out$index2 .

@rb643
Copy link
Author

rb643 commented Jul 19, 2021

Ah yeah seems to be a linux issue, works fine on the mac..

@tonigi tonigi closed this as completed Jul 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants