首页 > 解决方案 > 使用 R 绘制图像 conclute table 和文本描述

问题描述

我想画这样的图像。在此处输入图像描述

它不包含文本描述部分和表格部分。它来自 Excel。我尝试了一些方法,但没有奏效。这是我最接近成功的一次。

library(data.table)
library(gridExtra)
textdescribe <- 'Imagine the following scenario:
 Suppose you have a distance of 7KM from your home to your work unit. The specific mode of travel is shown in the table below.Which mode of travel will you choose?'
table <- data.table(travelmode=c('cost','spend time','congestion degree'), 
                    bus=c('2','44','crowded'), 
                    metro=c('3','16','loose'), 
                    car=c('/','15','/'),
                    taxi=c('19','15','/'))
grid.arrange(top=textdescribe, tableGrob(table))

但是我还是无法控制文字和表格看起来像Excel图片。R中是否有方法实现?因为我需要稍后批量生成图像。

标签: rimage

解决方案


推荐阅读