Dynamically plots out on the fly

how are we able to generate that kind of dynamic plots out in R Shiny using ggplot2 or plotly?
that is, users selects / deselects the data, then it will plot /remove plot accordingly on the same overlapping page.
Is this achievable in R Shiny in the first place?
I believe using some kind of reactive, it is possible, but with ggplot2 or plotly alone, are they sufficient?
Thanks for your input.

I have got some clue from this link: 17 Server-side linking with shiny | Interactive web-based data visualization with R, plotly, and shiny


ui <- fluidPage(
    inputId = "cities", 
    label = "Select a city", 
    choices = unique(txhousing$city), 
    selected = "Abilene",
    multiple = TRUE
  plotlyOutput(outputId = "p")

server <- function(input, output, ...) {
  output$p <- renderPlotly({
    plot_ly(txhousing, x = ~date, y = ~median) %>%
      filter(city %in% input$cities) %>%
      group_by(city) %>%

shinyApp(ui, server)

But I would like to further enhance it by:
adding different colors to the plots, such that the color of the plot would the same as the color of the words highlighted in the "Select a City", is it possible? so that we know which plot belongs to which city..
any help would be greatly appreciated.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.