show with app
library(shiny)

ui <- 
  fluidPage(
    selectInput("xvar", "Pick a variable for the x-axis", colnames(mtcars)[-1]),
    actionButton("button", "Update the plot"),
    plotOutput("myPlot")
  )

server <- 
  function(input, output) {
    
    xvar_new <- eventReactive(input$button, {input$xvar})
    
    output$myPlot <- 
      renderPlot({
        plot(mtcars[, xvar_new()], mtcars$mpg)
      })
  }

shinyApp(ui = ui, server = server, options = list(display.mode = "showcase"))