【发布时间】:2014-09-28 14:40:09
【问题描述】:
我有一个fluidRow,其中一列中呈现了一个绘图。我想知道当我通过 renderPlot({create plot here}, width = ##) 函数手动指定绘图宽度时如何使绘图居中(因此,它不占用列的整个宽度) .
ui.R 代码:
setwd("C:/Users/Nate/Documents/R Working Directory/appFolder/example")
shinyUI(fluidPage(
titlePanel("Test"),
sidebarLayout(
sidebarPanel(
p('stuff here')
),
mainPanel(
tabsetPanel(id = 'tabs1',
tabPanel("main",
fluidRow(
column(8,
plotOutput('plot1')),
column(4,
p('2nd column'))),
fluidRow(
p("2nd row of viewing area"))
),
tabPanel("second",
p("main viewing area")),
tabPanel("third",
p('main viewing area')
)
))
)
))
server.R 代码:
shinyServer(function(input, output, session) {
output$text1 = renderText({
paste("text output")
})
output$plot1 = renderPlot({
x = runif(10,0,10)
y = rnorm(10)
plot(x,y)
}, width = 300)
})
【问题讨论】: