【问题标题】:Shiny app is only half of browser window闪亮的应用程序只是浏览器窗口的一半
【发布时间】:2016-11-03 08:32:35
【问题描述】:

我最近开始学习 Shiny 并且正在开发我的第一个练习应用程序。出于某种原因,我的应用程序不会占用整个浏览器窗口,而是在一半左右被截断。该页面仍然可以向下滚动以查看其余输出,但由于某种原因折叠率很高。以下是我的代码:

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)

这是空白区域的截图:

Screenshot of the Shiny App

更新:

这是从 Rstudio 的查看器窗格中看到的样子:

Rstudio Screenshot

谢谢。

【问题讨论】:

  • 它在 Rstudio 中的外观如何?
  • 我更新了一张 Rstudio 截图。

标签: r shiny


【解决方案1】:

我遇到了同样的问题,试试

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

【讨论】:

  • 修复了它。谢谢!
猜你喜欢
  • 1970-01-01
  • 2016-05-20
  • 2013-07-04
  • 2017-03-03
  • 1970-01-01
  • 1970-01-01
  • 2019-03-23
  • 1970-01-01
  • 2019-08-20
相关资源
最近更新 更多