viewports(grid)
viewports()所属R语言包:grid
Maintaining and Navigating the Grid Viewport Tree
维护和导航电网Viewport的树
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Grid maintains a tree of viewports — nested drawing contexts.
电网维护一个视口中的树 - 嵌套绘图上下文。
These functions provide ways to add or remove viewports and to navigate amongst viewports in the tree.
这些功能提供的方式来添加或删除视口和树中的视口之间导航。
用法----------Usage----------
pushViewport(..., recording=TRUE)
popViewport(n, recording=TRUE)
downViewport(name, strict=FALSE, recording=TRUE)
seekViewport(name, recording=TRUE)
upViewport(n, recording=TRUE)
参数----------Arguments----------
参数:...
One or more objects of class "viewport".
"viewport"类的一个或多个对象。
参数:n
An integer value indicating how many viewports to pop or navigate up. The special value 0 indicates to pop or navigate viewports right up to the root viewport.
一个整数值,表示多少视口弹出或浏览。特殊值0表示根“视口中弹出或浏览视口。
参数:name
A character value to identify a viewport in the tree.
一个字符值,以确定在树视口中。
参数:strict
A boolean indicating whether the vpPath must be matched exactly.
一个布尔值,指示的vpPath是否必须完全匹配。
参数:recording
A logical value to indicate whether the viewport operation should be recorded on the Grid display list.
一个逻辑值,指示是否应在网格上显示列表记录的视口操作。
Details
详情----------Details----------
Objects created by the viewport() function are only descriptions of a drawing context. A viewport object must be pushed onto the viewport tree before it has any effect on drawing.
viewport()函数创建的对象是唯一的一个绘图上下文描述。视口对象必须推到视口的树前有任何图纸上的效果。
The viewport tree always has a single root viewport (created by the system) which corresponds to the entire device (and default graphical parameter settings). Viewports may be added to the tree using pushViewport() and removed from the tree using popViewport().
视口中的树总是有一个根口(由系统创建),相当于整个设备(和默认的图形参数设置)。视口,可添加到树使用pushViewport()“从树中删除使用popViewport()。
There is only ever one current viewport, which is the current position within the viewport tree. All drawing and viewport operations are relative to the current viewport. When a viewport is pushed it becomes the current viewport. When a viewport is popped, the parent viewport becomes the current viewport. Use upViewport to navigate to the parent of the current viewport, without removing the current viewport from the viewport tree. Use downViewport to navigate to a viewport further down the viewport tree and seekViewport to navigate to a viewport anywhere else in the tree.
是只有一个当前视口中,这是在当前视口树的位置。所有图纸和视口的操作是相对于当前视口中。当一个视口推它成为当前视口中。当视口被弹出,父视口成为当前视口中。使用upViewport导航到当前视口中的父,而不从当前视口视口树。使用downViewport导航到视口中进一步下降的视口树和seekViewport具竞争力的树导航到视口中。
If a viewport is pushed and it has the same name as a viewport at the same level in the tree, then it replaces the existing viewport in the tree.
如果视口推它具有相同的name在树中的同一级别的视口,然后在树取代现有的视口。
值----------Value----------
downViewport returns the number of viewports it went down.
downViewport返回的视口数了。
This can be useful for returning to your starting point by doing something like depth <- downViewport() then upViewport(depth).
这可能是有用的,做的东西一样depth <- downViewport()然后upViewport(depth)返回到您的出发点。
作者(S)----------Author(s)----------
Paul Murrell
参见----------See Also----------
viewport and vpPath.
viewport和vpPath。
举例----------Examples----------
# push the same viewport several times[推动同一个视口中多次]
grid.newpage()
vp <- viewport(width=0.5, height=0.5)
pushViewport(vp)
grid.rect(gp=gpar(col="blue"))
grid.text("Quarter of the device",
y=unit(1, "npc") - unit(1, "lines"), gp=gpar(col="blue"))
pushViewport(vp)
grid.rect(gp=gpar(col="red"))
grid.text("Quarter of the parent viewport",
y=unit(1, "npc") - unit(1, "lines"), gp=gpar(col="red"))
popViewport(2)
# push several viewports then navigate amongst them[推动多个视口,然后浏览他们当中]
grid.newpage()
grid.rect(gp=gpar(col="grey"))
grid.text("Top-level viewport",
y=unit(1, "npc") - unit(1, "lines"), gp=gpar(col="grey"))
if (interactive()) Sys.sleep(1.0)
pushViewport(viewport(width=0.8, height=0.7, name="A"))
grid.rect(gp=gpar(col="blue"))
grid.text("1. Push Viewport A",
y=unit(1, "npc") - unit(1, "lines"), gp=gpar(col="blue"))
if (interactive()) Sys.sleep(1.0)
pushViewport(viewport(x=0.1, width=0.3, height=0.6,
just="left", name="B"))
grid.rect(gp=gpar(col="red"))
grid.text("2. Push Viewport B (in A)",
y=unit(1, "npc") - unit(1, "lines"), gp=gpar(col="red"))
if (interactive()) Sys.sleep(1.0)
upViewport(1)
grid.text("3. Up from B to A",
y=unit(1, "npc") - unit(2, "lines"), gp=gpar(col="blue"))
if (interactive()) Sys.sleep(1.0)
pushViewport(viewport(x=0.5, width=0.4, height=0.8,
just="left", name="C"))
grid.rect(gp=gpar(col="green"))
grid.text("4. Push Viewport C (in A)",
y=unit(1, "npc") - unit(1, "lines"), gp=gpar(col="green"))
if (interactive()) Sys.sleep(1.0)
pushViewport(viewport(width=0.8, height=0.6, name="D"))
grid.rect()
grid.text("5. Push Viewport D (in C)",
y=unit(1, "npc") - unit(1, "lines"))
if (interactive()) Sys.sleep(1.0)
upViewport(0)
grid.text("6. Up from D to top-level",
y=unit(1, "npc") - unit(2, "lines"), gp=gpar(col="grey"))
if (interactive()) Sys.sleep(1.0)
downViewport("D")
grid.text("7. Down from top-level to D",
y=unit(1, "npc") - unit(2, "lines"))
if (interactive()) Sys.sleep(1.0)
seekViewport("B")
grid.text("8. Seek from D to B",
y=unit(1, "npc") - unit(2, "lines"), gp=gpar(col="red"))
pushViewport(viewport(width=0.9, height=0.5, name="A"))
grid.rect()
grid.text("9. Push Viewport A (in B)",
y=unit(1, "npc") - unit(1, "lines"))
if (interactive()) Sys.sleep(1.0)
seekViewport("A")
grid.text("10. Seek from B to A (in ROOT)",
y=unit(1, "npc") - unit(3, "lines"), gp=gpar(col="blue"))
if (interactive()) Sys.sleep(1.0)
seekViewport(vpPath("B", "A"))
grid.text("11. Seek from\nA (in ROOT)\nto A (in B)")
popViewport(0)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|