【发布时间】:2019-06-21 16:38:30
【问题描述】:
我有一个文档,其中我能够成功显示单个图像 - 由包含图像名称的变量引用 - 块如下:
```{r echo = FALSE, out.width = '100%'}
knitr::include_graphics(paste0(source_image_path,image_filename))
```
我需要的是能够对两个图像执行此操作,并将它们并排显示,并控制它们各自的宽度百分比。我尝试了this solution,但其中一张图片在以这种方式导入时非常粗糙,我无法控制宽度百分比,并且总宽度小于我想要的。
我也试过
```{r, out.width = "50%"}
img1 <- paste0(source_image_path,image_filename1)
img2 <- paste0(source_image_path,image_filename2)
myimages <- list(img1,img2)
include_graphics(myimages)
```
基于我发现的here;这看起来更好,但我不确定如何控制单个图像的宽度百分比。我尝试使用
include_graphics(myimages,dpi = c(2,85)) 无效。
那么我怎样才能并排显示 2 张由变量引用的图像,同时仍然控制各个宽度百分比?
【问题讨论】: