Html 如何使用knitr导入本地图像进行降价

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10517020/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 00:18:51  来源:igfitidea点击:

How to import local image using knitr for markdown

htmlimagemarkdownfigureknitr

提问by Steve Buyske

I have an externally created png image in a local directory that I'd like to import to a report using knitr. The ultimate target filetype is html. I have no trouble getting my own figures to appear when I create them with R code, but I'm at a loss what I would have thought was a simpler problem.

我在本地目录中有一个外部创建的 png 图像,我想使用 knitr 将其导入到报告中。最终目标文件类型是 html。当我用 R 代码创建我自己的数字时,我可以毫不费力地让我自己的数字出现,但我不知所措,我认为这是一个更简单的问题。

While I'm at it, how would I import a figure for which I have a url?

当我在做的时候,我将如何导入一个我有一个 url 的数字?

回答by Yihui Xie

If you already have a local image, you can just use the HTML or markdown syntax to include it in your document. HTML syntaxis <img src="path/to/your/image" />and markdownis ![title](path/to/your/image).

如果您已经有本地图像,则可以使用 HTML 或 Markdown 语法将其包含在您的文档中。HTML 语法<img src="path/to/your/image" />markdown![title](path/to/your/image).