Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shiny: Is it possible to make a vertical slider?

Tags:

r

slider

shiny

Is there any possibility to make a vertical slider in Shiny? I would basically want a plot, a vertical slider at its left, and a normal horizontal slider below it.

like image 417
meow Avatar asked Feb 10 '15 16:02

meow


People also ask

What is a vertical slider?

Split Screen Vertical Sliders As the user scrolls down the page, each side of the screen moves in independent sections in opposite directions, sliding to revealing new content.

How do I make a slider in R?

You create a range slider for your R Shiny app by using the values= -argument of the sliderInput widget. Normally, this argument defines one default value of the slider.


1 Answers

Now it is very easy with this noUiSliderInput() from the shinyWidgets package.

Example:

if (interactive()) {

### examples ----

# see ?demoNoUiSlider
demoNoUiSlider("more")


###  basic usage ----

library( shiny )
library( shinyWidgets )


ui <- fluidPage(

  tags$br(),

  noUiSliderInput(
    inputId = "noui1",
    min = 0, max = 100,
    value = 20
  ),
  verbatimTextOutput(outputId = "res1"),

  tags$br(),

  noUiSliderInput(
    inputId = "noui2", label = "Slider vertical:",
    min = 0, max = 1000, step = 50,
    value = c(100, 400), margin = 100,
    orientation = "vertical",
    width = "100px", height = "300px"
  ),
  verbatimTextOutput(outputId = "res2")

)

server <- function(input, output, session) {

  output$res1 <- renderPrint(input$noui1)
  output$res2 <- renderPrint(input$noui2)

}

shinyApp(ui, server)

}
like image 79
understorey Avatar answered Sep 20 '22 14:09

understorey