I am trying to rotate pickerinput so that the yaxis selection is right next to it.
I am attaching two examples:
- Using
shinyWidgets::pickerInput
- Using
shiny::selectInput
How do I make the pickerinput dropdown not be hidden behind the plot or appear like the dropdown for selectinput?
Code for example 1:
library(shiny)
library(shinyWidgets)
library(tidyverse)
shiny::shinyApp(
ui = fluidPage(
# Application title
titlePanel("Rotating Picker Input"),
# Sidebar with a slider input for number of bins
# Show a plot of the generated distribution
fluidRow(
column(
2,
fluidRow(
style = "transform: rotate(270deg) translateX(-150px) translateY(-50px); width: 350px; ",
shinyWidgets::pickerInput(
inputId = "select_y",
label = "Select Y",
choices = colnames(mtcars),
selected = colnames(mtcars)[1],
options = list(
`actions-box` = TRUE,
`selected-text-format` = "count > 2"
),
multiple = FALSE
)
)
),
column(
10,
plotOutput("distPlot"),
pickerInput(
inputId = "select_x",
label = "Select X",
choices = colnames(mtcars),
selected = colnames(mtcars)[1],
options = list(
`actions-box` = TRUE,
`selected-text-format` = "count > 2"
),
multiple = FALSE
)
)
)
),
# Define server logic required to draw a histogram
server = function(input, output) {
output$distPlot <- renderPlot({
# generate bins based on input$bins from ui.R
ggplot(data = mtcars) + geom_point(aes_string(x = input$select_x, y = input$select_y))
})
}
)
Code for example 2:
library(shiny)
library(shinyWidgets)
library(tidyverse)
shiny::shinyApp(
ui = fluidPage(
# Application title
titlePanel("Rotating Picker Input"),
# Sidebar with a slider input for number of bins
# Show a plot of the generated distribution
fluidRow(
column(
2,
fluidRow(
style = "transform: rotate(270deg) translateX(-150px) translateY(-50px); width: 350px; ",
shiny::selectInput(
inputId = "select_y",
label = "Select Y",
choices = colnames(mtcars),
selected = colnames(mtcars)[1],
selectize = FALSE
)
)
),
column(
10,
plotOutput("distPlot"),
pickerInput(
inputId = "select_x",
label = "Select X",
choices = colnames(mtcars),
selected = colnames(mtcars)[1],
options = list(
`actions-box` = TRUE,
`selected-text-format` = "count > 2"
),
multiple = FALSE
)
)
)
),
# Define server logic required to draw a histogram
server = function(input, output) {
output$distPlot <- renderPlot({
# generate bins based on input$bins from ui.R
ggplot(data = mtcars) + geom_point(aes_string(x = input$select_x, y = input$select_y))
})
}
)