首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使prophet输出的图形的宽度适合闪亮的窗口

使prophet输出的图形的宽度适合闪亮的窗口
EN

Stack Overflow用户
提问于 2020-04-28 22:30:11
回答 1查看 50关注 0票数 2

我想用闪亮的R语言显示由prophet创建的图表。

但是,当prophet输出的图形在shiny中显示时,图形的宽度小于窗口大小,并且可能会在左侧和右侧创建较大的空白区域。

如何使图形的宽度适合窗口大小?

代码语言:javascript
复制
library(prophet)
library(shiny)

df <- data.frame(
  ds = seq(as.Date("2014-01-01"), as.Date("2018-12-31"), by = "month"),
  y = sample(60)
)

m <- prophet(df)
future <- predict(m, data.frame(ds = df[, 1]))


ui <- fluidPage(
  plotOutput("plot.prophet")
)

server <- function(input, output) {
  output$plot.prophet <- renderPlot({plot(m, future)})
}

shinyApp(ui = ui, server = server)

The width of the graph is smaller than the window size, and there are large blank spaces on the left and right.

EN

回答 1

Stack Overflow用户

发布于 2020-04-29 02:56:06

ui中,您需要指定绘图的宽度。

代码语言:javascript
复制
ui <- fluidPage(
  plotOutput("plot.prophet", width = "100%")
)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61482704

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档