【问题标题】:Limit lattice plots to viewports?将晶格图限制为视口?
【发布时间】:2011-06-19 07:55:04
【问题描述】:

我想在现有地块的一个小区域中拟合整个格子图。

xyplot(decrease ~ treatment, OrchardSprays, groups = rowpos, type = "a")
pushViewport(viewport(.2, .7, .2, .2))
grid.rect(gp=gpar(fill="white"))

给我这个:

所以视口被推送。但是如果再次调用一个lattice函数时,它会使用整个设备,就像调用grid.newpage()

xyplot(decrease ~ treatment, OrchardSprays, groups = rowpos, type = "a")

有没有办法将晶格图限制在设备上的预定义区域,就像我上面的示例一样?

【问题讨论】:

    标签: r plot viewport lattice r-grid


    【解决方案1】:

    您必须直接调用print,并将newpage 参数设置为FALSE(与默认值相反):

    xyplot(decrease ~ treatment, OrchardSprays, groups = rowpos, type = "a")
    pushViewport(viewport(.2, .7, .2, .2))
    print(xyplot(decrease ~ treatment, OrchardSprays, groups = rowpos, type = "a"), newpage=FALSE)
    

    您可以在网格手册 (r_instalation_path/library/grid/doc/grid.pdf) 的“向网格中添加点阵”部分找到它。

    【讨论】:

      猜你喜欢
      • 2019-09-20
      • 1970-01-01
      • 2016-10-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-27
      • 1970-01-01
      相关资源
      最近更新 更多