Jas*_*lns 6 r r-markdown shiny rnotebook
考虑以下rmarkdown html_notebook示例:
---
output: html_notebook
runtime: shiny
---
```{r}
library(ggplot2)
library(shiny)
blank1 <- renderPlot({ ggplot() + labs(title = "Plot 1") })
blank2 <- renderPlot({ ggplot() + labs(title = "Plot 2") })
blank3 <- renderPlot({ ggplot() + labs(title = "Plot 3") })
column(6, blank1, blank2)
column(6, blank3)
```
Run Code Online (Sandbox Code Playgroud)
我想将地块显示为:
我尝试了一些事情,包括:
fluidRow(
column(6, blank1, blank2),
column(6, blank3)
)
Run Code Online (Sandbox Code Playgroud)
但是我无法Plot 3跨越多行。
附加说明(每个注释):
cowplot或patchwork解决方案,但我需要从shiny(例如ggplot(aes(x = input$var_select)) + ...。column()和/或fluidRow()保留响应式设计方面。我能够通过renderPlot显式传递高度来解决这个问题。我对其他解决方案仍然很感兴趣:
blank1 <- renderPlot({ ggplot() + labs(title = "Plot 1") }, height = 200)
blank2 <- renderPlot({ ggplot() + labs(title = "Plot 2") }, height = 200)
blank3 <- renderPlot({ ggplot() + labs(title = "Plot 3") }, height = 400)
fluidRow(
column(6, fluidRow(blank1), fluidRow(blank2)),
column(6, fluidRow(blank3))
)
Run Code Online (Sandbox Code Playgroud)
从响应式设计方法来看,它并不完美,但它会起作用。
| 归档时间: |
|
| 查看次数: |
107 次 |
| 最近记录: |