你能在 R Markdown 的 flexdashboard 中顶部对齐绘图或图像吗?
Can you top align a plot or image in R Markdown's flexdashboard?
---
title: "How do you top align this figure below?"
output: flexdashboard::flex_dashboard
---
```{r c1, fig.width=9}
plot(mtcars)
```
当我最大化我的仪表板时,上面的 R flexdashboard 代码生成了一个垂直居中的图 window。看起来像这样。
相反,我希望图像垂直顶部对齐,图像上方没有白色 space。它看起来像下图,任何备用白色 space 都放在图像下方(如果您的 window 最大化)。如果您的输出与我的不完全匹配,只需将您的输出 window 调整为又高又瘦(想想旋转的“编码”监视器)。
R Markdown 参数 fig.align
只有水平选项(left
、right
、center
)而 flexdashboard 参数 .no-padding
似乎没有帮助。
如何让 flexdashboard 在 R Markdown 中顶部对齐?
您可以使用 css
覆盖图像的 background
位置。
---
title: "Flex"
author: ""
output:
flexdashboard::flex_dashboard:
orientation: rows
css: styles.css
---
Page One
=======================================================================
Row
-----------------------------------------------------------------------
### chart1
```{r, fig.width=12}
plot(mtcars)
```
styles.css(在同一工作目录中):
.image-container {
background-position: center top !important;
}
---
title: "How do you top align this figure below?"
output: flexdashboard::flex_dashboard
---
```{r c1, fig.width=9}
plot(mtcars)
```
当我最大化我的仪表板时,上面的 R flexdashboard 代码生成了一个垂直居中的图 window。看起来像这样。
相反,我希望图像垂直顶部对齐,图像上方没有白色 space。它看起来像下图,任何备用白色 space 都放在图像下方(如果您的 window 最大化)。如果您的输出与我的不完全匹配,只需将您的输出 window 调整为又高又瘦(想想旋转的“编码”监视器)。
R Markdown 参数 fig.align
只有水平选项(left
、right
、center
)而 flexdashboard 参数 .no-padding
似乎没有帮助。
如何让 flexdashboard 在 R Markdown 中顶部对齐?
您可以使用 css
覆盖图像的 background
位置。
---
title: "Flex"
author: ""
output:
flexdashboard::flex_dashboard:
orientation: rows
css: styles.css
---
Page One
=======================================================================
Row
-----------------------------------------------------------------------
### chart1
```{r, fig.width=12}
plot(mtcars)
```
styles.css(在同一工作目录中):
.image-container {
background-position: center top !important;
}