R 图的大小是多少?
我越来越接近于生产我想要的产品,但现在我在调整rChart输出的大小和对齐方面遇到了困难。现在我的输出在第二列的左下角。我希望输出集中在第二列,如果可能的话,调整大小以更好地适应它 这是我的ui.R:R 图的大小是多少?,r,shiny,rcharts,R,Shiny,Rcharts,我越来越接近于生产我想要的产品,但现在我在调整rChart输出的大小和对齐方面遇到了困难。现在我的输出在第二列的左下角。我希望输出集中在第二列,如果可能的话,调整大小以更好地适应它 这是我的ui.R: require(rCharts) shinyUI(fluidPage( titlePanel("Quiz 3 grades distribution"), fluidRow( column(3, #helpText("Select grade in Quiz 1 be
require(rCharts)
shinyUI(fluidPage(
titlePanel("Quiz 3 grades distribution"),
fluidRow(
column(3,
#helpText("Select grade in Quiz 1 before the treatment:"),
selectInput("select", label = h3("Grade Quiz 1 before the treatment:"),
choices = list("All" = 0, "Not Perfect" = 1, "Perfect" = 2),
selected = 0)
),
column(9, showOutput("histogram","nvd3"), class = "span6")
)
))
谢谢你的帮助 您可以使用
$params$width
和$params$height
选项调整绘图的大小。您的span6
调用与将声明span9
类的列(9
不兼容。您可以使用CSS样式选项来对齐内容:
library(rCharts)
library(shiny)
X <- data.frame(Var1 = c(1L, 2L, 3L, 4L, 5L, 6L, 7L,8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L, 2L,3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L),
Var2 = structure(c(1L,1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L), .Label = c("control","treatment1", "treatment2"), class = "factor"),
Freq = c(0L,0L, 3L, 2L, 6L, 9L, 13L, 36L, 50L, 497L, 0L, 2L, 1L, 3L, 6L, 4L, 11L, 29L, 50L, 499L, 1L, 2L, 0L, 2L, 5L, 6L, 12L, 22L, 63L,490L)
)
runApp(
list(ui = fluidPage(
titlePanel("Quiz 3 grades distribution"),
fluidRow(
column(3,
#helpText("Select grade in Quiz 1 before the treatment:"),
selectInput("select", label = h3("Grade Quiz 1 before the treatment:"),
choices = list("All" = 0, "Not Perfect" = 1, "Perfect" = 2),
selected = 0)
),
column(9, div(showOutput("histogram","nvd3")), style = 'align:center;')
)
),
server = shinyServer(
function(input, output, session) {
output$histogram <- renderChart2({
n2 <- nPlot(Freq ~ Var1, group = 'Var2', data = X, type = 'multiBarChart')
n2$params$width <- 500
n2$params$height <- 400
n2
})
}
)
)
)
库(rCharts)
图书馆(闪亮)
请考虑提供一个可重复的例子。如果你的问题是闪亮的,你可以使用<代码> RunApp来做这件事。