【发布时间】:2014-05-17 06:53:44
【问题描述】:
使用目前的 RStudio 开发版本 (0.98.758),我很高兴我可以在 rmarkdown 中编写 ioslides 演示文稿。
rmarkdown docs for this format 描述了如何进行两列幻灯片,并附带以下警告:
请注意,内容将跨列流动,因此如果您希望在一侧放置图像而在另一侧放置文本,则应确保图像具有足够的高度以将文本强制到幻灯片的另一侧。
但我似乎无法制作足够大的图像!文本仍然被推离第一列的底部。在下面的演示文稿中,我想将基本直方图与 qplot 直方图在列中并排比较,并带有一些 cmets 和代码。我已经包含了一个相对简短的示例代码,其中包含一些基本的解决方案尝试。如果你会编织它,我认为问题会很明显。 (请注意,您需要preview version of RStudio。)
---
title: "Two Column"
author: "Some guy on Stack Overflow"
date: "Friday, April 04, 2014"
output: ioslides_presentation
---
## Two-Column Attempt {.smaller}
<div class="columns-2">
Base graphics can be quick...
```{r, fig.width = 3, fig.height = 4}
par_opts <- names(par())
hist(nchar(par_opts),
breaks = seq(1.5, 9.5, by = 1))
```
But `ggplot2` can be quick too:
```{r, fig.width = 2.5, fig.height = 2.5}
require(ggplot2, quietly = T)
qplot(factor(nchar(par_opts)))
```
</div>
## Two-Column Attempt: Taller Hist {.smaller}
<div class="columns-2">
Base graphics can be quick...
```{r, fig.width = 3, fig.height = 6}
par_opts <- names(par())
hist(nchar(par_opts),
breaks = seq(1.5, 9.5, by = 1))
```
But `ggplot2` can be quick too:
```{r, fig.width = 2.5, fig.height = 2.5}
require(ggplot2, quietly = T)
qplot(factor(nchar(par_opts)))
```
</div>
## Two-Column Attempt: Extra div {.smaller}
<div class="columns-2">
Base graphics can be quick...
```{r, fig.width = 3, fig.height = 4}
par_opts <- names(par())
hist(nchar(par_opts),
breaks = seq(1.5, 9.5, by = 1))
```
<div>
...
</div>
But `ggplot2` can be quick too:
```{r, fig.width = 2.5, fig.height = 2.5}
require(ggplot2, quietly = T)
qplot(factor(nchar(par_opts)))
```
</div>
这是第四张幻灯片的图片,您可以看到左栏底部的文字被截断,而右栏有足够的空间。
【问题讨论】:
标签: r rstudio r-markdown