R Blogdown:使用Knitr并排插入图像 [英] R Blogdown: insert images side by side using knitr

查看:82
本文介绍了R Blogdown:使用Knitr并排插入图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Blogdown在个人网站上进行工作.我知道用于插入图像的便捷插件-效果很好,但仅适用于一张图像.是否可以使用knitr::include_graphics并排插入多个图像?

I am working on a personal website using blogdown. I know about the handy addin for inserting an image - it works well, but for only one image. Is there a way, using knitr::include_graphics, to insert multiple images side-by-side?

我知道使用类似这样的东西: ![image text](path/to/image.png) ![other image text](path/to/image2.png)

I'm aware of using something like this: ![image text](path/to/image.png) ![other image text](path/to/image2.png)

但这无法调整每个图像的大小,这对我来说是一个重要的格式化选项.

But this cannot adjust the size of each image, which is an important formatting option for me.

注意:
在发布此问题之前四处寻找解决方案时,发现此github问题似乎和我在说的类似.

Note:
While poking around for a solution before I post this question, I found this github issue which seems to be similar to what I'm talking about.

修改:
使用这样的东西: <img src="path/to/image.png" width="50%"/><img src="path/to/image2.png" width="50%"/> 提出了建议,但它仅在文档中将图像显示在彼此的上方.

Edit:
Using something like this: <img src="path/to/image.png" width="50%"/><img src="path/to/image2.png" width="50%"/> Was suggested, but it only displays the images on top of each other in the document.

推荐答案

我将发布上述注释中提到的解决方案,因为它对我来说是最有效的,因此,我一定会回到这篇文章中使用此解决方案未来.答案在这里似乎是唯一对我有用的东西.如果很难正确获取路径名,请在上面的行中运行命令getwd()以确保readPNG在正确的位置.

I'll post the solution mentioned in the above comments since it worked the best for me, and I'll certainly come back to this post to use this in the future. The answer here seems to be the only thing that works for me. If getting the path name correct is difficult, run the command getwd() in the line above to make sure readPNG is looking in the right place.

这篇关于R Blogdown:使用Knitr并排插入图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆