使用R Markdown在HTML报告中的几个图上滚动
使用R MARKDOWN,我想生成一个HTML报告,可以在同一“窗口”中浏览多个图,例如,使用带有两个箭头按钮的滚动条来打印上一个和下一个绘图。我发现了几个问题,询问如何在大数字或图像中滚动,但无法确定在几个图之间滚动的解决方案。 例如,在下面编织RMD代码将在彼此的顶部生成三个图。我应该使用哪种代码使它们滚动?
编辑:我需要一个“单页视图”来轻松比较两个连续的图,即我应该能够以离散而不是连续的方式移动滚动条。
---
title: "Test multiple plots"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Generating multiple plots
I would like these three plots to be at the same location, and to switch between them by pressing buttons or sliding a scroll bar in the html document.
```{r plots, echo = F}
plot(0, pch = 16, col = 1)
plot(0, pch = 16, col = 2)
plot(0, pch = 16, col = 3)
```
感谢您的帮助。
Using R Markdown, I would like to generate an html report where I could browse multiple plots in the same 'window', e.g. using a scrollbar with two arrow buttons to print the previous and next plot. I have found several questions asking how to scroll within a large figure or image, but could not identify a solution to scroll between several plots.
For example, knitting the Rmd code below would generate three graphs on the top of each other. Which code should I use to make them scrollable?
EDIT: I need a 'single page view' to easily compare two consecutive plots, i.e. I should be able to move the scrollbar in a discrete, not continuous, way.
---
title: "Test multiple plots"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Generating multiple plots
I would like these three plots to be at the same location, and to switch between them by pressing buttons or sliding a scroll bar in the html document.
```{r plots, echo = F}
plot(0, pch = 16, col = 1)
plot(0, pch = 16, col = 2)
plot(0, pch = 16, col = 3)
```
Thank you for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用以下代码:
输出:
您会看到有一个垂直滚动条。您可以更改
样式
的高度和宽度,以使视图更大或更小。You can use the following code:
Output:
You will see that there is a vertical scrollbar. You can change the height and width in the
style
to make the view bigger or smaller.