R降价 - flexdashboard - 网格布局&滚动&标签集

时间:2018-02-09 09:14:24

标签: r r-markdown flexdashboard

我试图弄清楚如何组合网格布局,行方向标签集以及在markdown / flexdashboard中滚动的功能。

enter image description here

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

enter image description here

这可能吗?

---
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

1 个答案:

答案 0 :(得分:2)

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

enter image description here

这是代码

---
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")
```