关于算法:拓端tecdatggplot2如何在R语言中绘制表格

10次阅读

共计 1039 个字符,预计需要花费 3 分钟才能阅读完成。

原文连贯:http://tecdat.cn/?p=6154

偶然我想在 R 中的图表旁边绘制一个表格,例如,显示图表自身的摘要统计数据。非常简单。该函数 tableGrob 创立像一个数据帧的 曲线图表 ,显示在ggplot2 图形对象的网页上。

这是一个小例子:

p+
+   annotation_custom(grob = tableGrob(table, rows = NULL),
+                     ymin = 7.5,ymax = 14)+
+   theme(axis.text = element_text(size = 14),
+         axis.title = element_text(size = 16))

会话信息

R version 3.2.1 (2015-06-18)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.4 (Yosemite)

locale:
\[1\] en\_GB.UTF-8/en\_GB.UTF-8/en\_GB.UTF-8/C/en\_GB.UTF-8/en_GB.UTF-8

attached base packages:
\[1\] stats     graphics  grDevices utils     datasets  methods  
\[7\] base     

other attached packages:
\[1\] gridExtra\_2.0.0 ggplot2\_1.0.1  

loaded via a namespace (and not attached):
 \[1\] Rcpp\_0.11.6      digest\_0.6.8     MASS_7.3-42     
 \[4\] grid\_3.2.1       plyr\_1.8.3       gtable_0.1.2    
 \[7\] magrittr\_1.5     scales\_0.2.5     stringi_0.5-5   
\[10\] reshape2\_1.4.1   proto\_0.3-10     labeling_0.3    
\[13\] tools\_3.2.1      stringr\_1.0.0    munsell_0.4.2   
\[16\] colorspace_1.2-6
正文完
 0