2011-02-01 5 views
6

既存のプロットの小さな領域に全体の格子プロットを合わせたいと思います。ラティスプロットをビューポートに限定しますか?

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

私にこれを与える:

enter image description here

だから、ビューポートが押されました。とき、格子関数が再び呼び出された場合grid.newpage()を呼び出すかのように。しかし、それは、全体のデバイスを使用しています:

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

は、上記の私の例のように、デバイス上の事前定義された領域に格子状プロットを制限する方法はありますか?

答えて

6

あなたが直接(反対のデフォルト値に)FALSEに設定newpage引数でprintを呼び出す必要があります:あなたはグリッド・マニュアル(r_instalation_path /ライブラリ/グリッド/ DOC/grid.pdf)でそれを見つけることができる

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) 

、「グリッドに格子を追加する」の項を参照してください。

enter image description here

関連する問題