When we create a shiny app, users will use the app on different screen sizes (laptops, monitors). This means there are different heights and widths per user which may transform the graphs which have been developed on one screen size. I would like to have a way that every user gets the same size so that when zooming it shouldn’t return overlapping labels and weirdly scaled graphs. Here I create a really simple reproducible example:
library(shiny)
library(plotly)
library(dplyr)
ui <- fluidPage(
headerPanel('Example'),
mainPanel(
plotlyOutput('plot')
)
)
server <- function(input, output) {
output$plot <- renderPlotly(
plot1 <- plot_ly(
x = ~rnorm(50, mean = 0, sd = 1),
type = 'histogram') %>%
layout(xaxis = list(tickvals = seq(-2.2, 2.2, 0.2)))
)
}
shinyApp(ui,server)
When zooming on a laptop returns this:
When zooming on a monitor:
As you can see the graphs are completely different because they are shown on different screen sizes. So I was wondering if anyone knows if there is an option to keep the same graphs sizes on different screens sizes?
3