闪亮图表空间分配 [英] Shiny Chart Space Allocation

查看:10
本文介绍了闪亮图表空间分配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面的示例将4个组一起绘制在4个窗格中。但问题是,它们似乎驻留在单一的网格中。有没有可能在闪亮的输出中控制图表的大小?(例如,当应用程序运行时,右侧没有滚动条)我试图控制高度和宽度,但这似乎只控制了网格本身内的图像。有什么想法吗?

谢谢

shinyUI(pageWithSidebar(
  headerPanel("Example"),
  sidebarPanel(   

  ),

  mainPanel(
    tabsetPanel(tabPanel("Main",plotOutput("temp"))

    )#tabsetPanel  

  )#mainPane;

))



shinyServer(function(input, output) {

  output$temp <-renderPlot({
     par(mfrow=c(2,2))
     plot(1:10)
     plot(rnorm(10))
     plot(rnorm(10))
     plot(rnorm(10))
  }, height = 1000, width = 1000)


})

推荐答案

plotOutput也有Height和Width参数,宽度默认为"100%"(表示容器中可用宽度的100%),高度默认为"400px"(400像素)。尝试使用这些值,将其更改为"auto""1000px"

renderPlot的Height和Width参数控制生成的图片文件的大小(以像素为单位),但不直接影响网页渲染的大小,默认值都是"auto",表示检测并使用对应plotOutput的宽度/高度,所以一旦设置了plotOutput的宽度和高度,一般都不需要在renderPlot上设置宽度和高度。

shinyUI(pageWithSidebar(
  headerPanel("Example"),
  sidebarPanel(   

  ),

  mainPanel(
    tabsetPanel(tabPanel("Main",plotOutput("temp", height = 1000, width = 1000))

    )#tabsetPanel  

  )#mainPane;

))



shinyServer(function(input, output) {

  output$temp <-renderPlot({
     par(mfrow=c(2,2))
     plot(1:10)
     plot(rnorm(10))
     plot(rnorm(10))
     plot(rnorm(10))
  })


})

这篇关于闪亮图表空间分配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆