R Блестящие Макеты - PullRequest
       32

R Блестящие Макеты

0 голосов
/ 24 апреля 2018

На моей блестящей панели инструментов я в настоящее время строю 1 столбчатую диаграмму выше и 4 круговых диаграммы ниже, как показано ниже:

fluidRow(
  column(12, plotOutput("bar1"))),
  fluidRow(
    column(3, plotOutput("pie")),
    column(3, plotOutput("pie2")),
    column(3, plotOutput("pie3")),
    column(3, plotOutput("pie4")))

Как мне построить диаграмму в виде гистограммы вместе с 4 круговыми диаграммами, с круговыми диаграммами, расположенными в квадрате?

Эффективно, если бы гистограмма была бы column(6,..., а все круговые диаграммы были бы column(3,..., но мне бы понадобилось, чтобы гистограмма была расширена до 2 строк, чтобы круговые диаграммы располагались непосредственно рядом с ней.

1 Ответ

0 голосов
/ 24 апреля 2018

Стандарт plotOutput имеет высоту 400px

plotOutput (outputId, width = "100%", height = "400px", click = NULL,
dblclick = NULL, hover = NULL, hoverDelay = NULL, hoverDelayType = NULL, brush = NULL, clickId = NULL, hoverId = NULL, inline = FALSE)

Так что вы можете сделать следующее:

library(shiny)

ui <- fluidPage(
  fluidRow(
    column(6, plotOutput("bar1",height = "800px")),
    column(6,
           column(6, plotOutput("pie")),
           column(6, plotOutput("pie2")),
           column(6, plotOutput("pie3")),
           column(6, plotOutput("pie4"))

    ))
)

server <- function(input, output) {

  output$bar1 <- renderPlot({
    hist(rnorm(1:100));box();grid()
  })
  output$pie <- renderPlot({
    plot(rnorm(1:100));box();grid()
  })
  output$pie2 <- renderPlot({
    plot(rnorm(1:100));box();grid()
  })
  output$pie3 <- renderPlot({
    plot(rnorm(1:100));box();grid()
  })
  output$pie4 <- renderPlot({
    plot(rnorm(1:100));box();grid()
  })
}

shinyApp(ui,server)

enter image description here

...