我想知道如何修复一块地块.绘图以数组排列,以便一行中的所有绘图具有相同的Y轴变量,并且列中的所有绘图具有相同的X轴变量.
当在网格中连接在一起时,这将创建一个多重绘图.我禁用大多数图表上的标签,除了外部标签,因为内部标签具有相同的变量和比例.但是,由于外部图表具有标签和轴值,因此它们会产生与其他图案不同的大小.
我想在网格中添加2个列和行,用于变量名称和轴范围值...然后仅绘制相应网格空间上的变量名称和另一个网格空间上的轴值,因此仅绘制在剩余空间中指向并获得相同的大小.
编辑1:感谢rcs指点我 align.plot
编辑align.plot接受空值(当不需要轴中的标题/文本时)
现在我更接近目标了,但由于标签的缘故,第一个columun图的宽度仍然比其余的小.
示例代码:
grid_test <- function ()
{
dsmall <- diamonds[sample(nrow(diamonds), 100), ]
#-----/align function-----
align.plots <- function(gl, ...){
# Obtained from http://groups.google.com/group/ggplot2/browse_thread/thread/1b859d6b4b441c90
# Adopted from http://ggextra.googlecode.com/svn/trunk/R/align.r
# BUGBUG: Does not align horizontally when one has a title.
# There seems to be a spacer used when a title is present. Include the
# size of the spacer. Not sure how to do this yet.
stats.row <- vector( "list", gl$nrow )
stats.col <- vector( "list", …Run Code Online (Sandbox Code Playgroud)