0
votes

I'm having some trouble with a plotOutput that depends on two different inputs. I need to find a way to modify the part of the plot block that depends on the second input without re-ploting everything.

My plot block is something like that:

output$some_output<-renderPlot({
    im<-load.image(input$a)
    plot(im)
    if(input$b == something){
        points(1,2) //or anything over that image plot
    }
})

What i need, is to somehow don't re-plot the image when input$b changes. I started not so far ago with Shiny, so i still don't understand every reactive function it has. Any idea is welcome.

1

1 Answers

0
votes

Use isolate(), this will remove the reactivity from input$b and only update the plot when input$a is changed. References can be found here https://shiny.rstudio.com/articles/isolation.html

output$some_output<-renderPlot({
    im<-load.image(input$a)
    plot(im)
    if(isolate(input$b) == something){
        points(1,2) //or anything over that image plot
    }
})

In the future, it is a good idea to give an entire working example so people can test to make sure the solution works.