【问题标题】:R markdown - flexdashboard - grid layout & scroll & tabsetR markdown - flexdashboard - 网格布局 & 滚动 & tabset
【发布时间】:2018-07-20 00:25:57
【问题描述】:

我试图弄清楚如何结合网格布局、按行选项卡集和在 markdown / flexdashboard 中滚动的能力。

我想要实现的是 Tab 3 应该位于 Tab 1 和 2 的右侧,并且能够向下滚动到 Tab 4-6(其中 Tab 6 应该位于 4/5 的右侧)。 像这样的:

这可能吗?

---
title: "Test"
output: 
  flexdashboard::flex_dashboard:
    orientation: row
    vertical_layout: scroll

---

```{r setup, include=FALSE}
library(flexdashboard)
```


A {data-orientation=rows}
===================================================

Row {data-width=500 data-height=400 .tabset}
-----------------------------------------------------------------------

### Tab 1 {data-height=400 data-width=500}

```{r}
plot(rnorm(10))
```

### Tab 2 {data-height=400 data-width=500}

```{r}
plot(rnorm(10))
```

Column 
-----------------------------------------------------------------------

### Tab 3 {data-height=400 data-width=300}
Some text


Row {data-width=500 data-height=400 .tabset}
-----------------------------------------------------------------------

### Tab 4 {data-height=400 data-width=500}

```{r}
plot(rnorm(10))
```

### Tab 5 {data-height=400 data-width=500}

```{r}
plot(rnorm(10))
```


Column 
-----------------------------------------------------------------------

### Tab 6 {data-height=400 data-width=300}

Some text

【问题讨论】:

标签: r r-markdown flexdashboard


【解决方案1】:

这是解决您问题的可能方法

这是代码

---
title: "Test"
output: flexdashboard::flex_dashboard
---

```{r setup, include=FALSE}
library(flexdashboard)
require(shinydashboard)
require(shiny)
require(plotly)
```


A {data-orientation=rows}
===================================================

Row
-----------------------------------------------------------------------

```{r}
p1 <- plot_ly(x = 1:10, y = rnorm(10))
tabBox(width=5,tabPanel("Tab1", p1), tabPanel("Tab2"), height = "450px")
```

```{r}
tabBox(width=7, tabPanel("Tab3","Some text"), height = "450px")
```

Row
-----------------------------------------------------------------------

```{r}
p2 <- plot_ly(x = 1:10, y = rnorm(10))
tabBox(width=5, tabPanel("Tab4",p2), tabPanel("Tab5"), height = "450px")
```

```{r}
tabBox(width=7, id = "tabset4", tabPanel("Tab6","Some text"), height = "450px")
```

【讨论】:

  • 虽然您的解决方案运行良好,但绘图会在较大的选项卡面板(宽度 7)的左上角对齐。我怎样才能使它们居中?
猜你喜欢
  • 1970-01-01
  • 2021-11-21
  • 1970-01-01
  • 1970-01-01
  • 2018-09-26
  • 2019-03-03
  • 2018-10-04
  • 2019-03-24
  • 2022-01-10
相关资源
最近更新 更多