小编Rob*_*ing的帖子

knitr:设置“out.height”突然不保持纵横比

通过在 rmarkdown ioslides 演示文稿中使用knitr::include_graphicswith 选项out.height='50px',纵横比不会保留在我的机器上。有谁知道如何解决这个问题?

有趣的是,今天早上它起作用了。但不是在我安装了 R 包之后ggsn, ggmap, plotKML。后来我删除了它们,但问题仍然存在。

我使用:Ubuntu 16.04.4,R 版本 3.4.4,当前 rmarkdown

最小的例子是:

---
title: "Untitled"
author: "Me"
date: "May 24, 2018"
output: ioslides_presentation
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo =T)
```

## R Markdown
setting out.height does NOT keep aspect ratio
```{r, out.height='50px', dpi=200}
   knitr::include_graphics("rect_circ.png")
```

setting out.width keeps aspect ratio
```{r, out.width='50px', dpi=200}
knitr::include_graphics("rect_circ.png")
```
Run Code Online (Sandbox Code Playgroud)

输出看起来像这样

graphics aspect-ratio knitr r-markdown ioslides

5
推荐指数
1
解决办法
1321
查看次数

如何放大Rmarkdown演示文稿中的图

我正在创建我的第一个HTML-带有rmarkdown的演示文稿(ioslides),并且希望能够手动放大幻灯片并导航到一个对象。
在浏览器(crtl +,crtl鼠标滚轮)中,缩放效果很好,但是我无法移动幻灯片。既不使用鼠标也不使用滚动条。后者不会像在网站上那样出现。
是否有实现这种事情的适当方法,或者不打算像这样使用滑坡?

我正在使用Ubuntu 16.04(LXDE)和rstudio(R版本3.2.3)。我尝试在Firefox和Chromium中进行缩放和导航。

例:

---
title: Zooming into an ioslide
author: "Robatt"
output: 
 ioslides_presentation: 
 fig_caption: yes
---

```{r setup, include=FALSE}
 knitr::opts_chunk$set(echo = FALSE)
```
##The slide to zoom in and navigate

```{r fig.align='left', out.width = "100px", dpi=300, 
fig.cap="a small graph to zoom in, when necessary"}
library(ggplot2)
x=c(1:30,by=0.1)
y=x/(1+x)
ggplot()+
  geom_smooth(aes(x=x,y=y),se=F,span=0.15,color="grey20")+
  labs(x="you can only read me after zooming in")
```
Run Code Online (Sandbox Code Playgroud)

这也是我第一次没有找到关于stackoverflow的答案,因此也第一次没有找到答案。

html css jquery r-markdown ioslides

4
推荐指数
1
解决办法
1453
查看次数

标签 统计

ioslides ×2

r-markdown ×2

aspect-ratio ×1

css ×1

graphics ×1

html ×1

jquery ×1

knitr ×1