Shiny:是否可以制作垂直滑块? [英] Shiny: Is it possible to make a vertical slider?
本文介绍了Shiny:是否可以制作垂直滑块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有可能在 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.
推荐答案
现在使用 shinyWidgets 包.
Now it is very easy with this noUiSliderInput()
from the shinyWidgets package.
例子:
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)
}
这篇关于Shiny:是否可以制作垂直滑块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文