Shiny app is only half of browser window

帅比萌擦擦* 提交于 2020-01-30 06:49:05

问题


I've recently started learning Shiny and am developing my first practice app. For some reason, my app doesn't take up the entire browser window but is cutoff about half way. The page can still scroll down to see the rest of the output but there is a high fold for some reason. Below is my code:

library(foreign)
library(dplyr)
library(shiny)
library(dplyr)
library(ggplot2)
library(shinythemes)

thesis <- read.csv("thesis.csv", stringsAsFactors = T)

ui <- fluidPage(theme = shinytheme("cerulean"),

  # Application title
  titlePanel("Annual Prices by City"),

  # Sidebar with choice selected
  sidebarLayout(
    sidebarPanel(
      selectInput("city","City",as.character(thesis$city)),
      tableOutput("table")
    ),

    # Show a time series line plot
    mainPanel(
      textOutput("cityheader"),
      plotOutput("plot", width="100%")

    )
  )
)


server <- function(input, output, session) {
  df <- reactive({
    thesis %>%
      select(city, year, price) %>%
      filter(city == input$city)

  })

  output$plot <- renderPlot({
    ggplot(df(), aes(x=year, y=price)) + 
      labs(title=input$city, x="Year", y="Annual Avg Price") + 
      geom_line(col="blue") 

  }, height=400, width = 700)

  output$table <- renderTable({
    df()

  })

  output$cityheader <- renderText({
    input$city
  })

}

shinyApp(ui=ui,server=server)

Here is a screenshot of the white space:

Screenshot of the Shiny App

UPDATE:

Here is what it looks like from within the viewer's pane in Rstudio:

Rstudio Screenshot

Thanks.


回答1:


I had the same issue, try

shinyApp(ui = ui, server = server, options = list(height = 1080))


来源:https://stackoverflow.com/questions/38136774/shiny-app-is-only-half-of-browser-window

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!