R 闪亮图表空间分配
下面的示例在4个窗格中同时绘制4个组。但问题是,它们似乎位于一个网格中。是否可以控制输出中图表的大小?(即,当应用程序运行时,右边没有滚动条)我试图控制高度和宽度,但这似乎只能控制网格内的图像本身。。。有什么想法吗 谢谢R 闪亮图表空间分配,r,shiny,R,Shiny,下面的示例在4个窗格中同时绘制4个组。但问题是,它们似乎位于一个网格中。是否可以控制输出中图表的大小?(即,当应用程序运行时,右边没有滚动条)我试图控制高度和宽度,但这似乎只能控制网格内的图像本身。。。有什么想法吗 谢谢 shinyUI(pageWithSidebar( headerPanel("Example"), sidebarPanel( ), mainPanel( tabsetPanel(tabPanel("Main",plotOutput("temp"
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)
})
shinyUI(带侧栏的页面)(
headerPanel(“示例”),
侧边栏(
),
主面板(
tabsetPanel(tabPanel(“主”),plotOutput(“临时”)
)#选项卡面板
)#主窗格;
))
shinyServer(功能(输入、输出){
output$tempplotOutput
也有高度和宽度参数;宽度默认为“100%”
(表示容器中可用宽度的100%),高度默认为“400px”
(400像素)。尝试试用这些值,将其更改为“auto”
或“1000px”
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))
})
})
shinyUI(带侧栏的页面)(
headerPanel(“示例”),
侧边栏(
),
主面板(
tabsetPanel(tabPanel(“主”,绘图输出(“温度”,高度=1000,宽度=1000))
)#选项卡面板
)#主窗格;
))
shinyServer(功能(输入、输出){
输出$temp如果我有navbarPage
控制输出,因此我没有plotOutput
可操作,我该怎么办?谢谢Joe,auto现在似乎工作不太好。使用plotOutput(“screenplot”,width=“100%”,height=“auto”)
并且Chrome中没有显示图表。我在帮助中看到了它的状态请注意,对于高度,使用“自动”或“100%”通常不会像预期的那样工作,因为高度是用HTML/CSS计算的。“除了固定高度,您现在可以推荐什么?谢谢。”