grid.arrows(grid)
grid.arrows()所属R语言包:grid
Draw Arrows
画箭头
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Functions to create and draw arrows at either end of a line, or at either end of a line.to, lines, or segments grob.
函数来创建和画线的任一端的箭头,或在一个line.to,线,或段GROB两端。
These functions have been deprecated in favour of arrow arguments to the line-related primitives.
赞成arrow参数行相关的原语,这些功能已被弃用。
用法----------Usage----------
grid.arrows(x = c(0.25, 0.75), y = 0.5, default.units = "npc",
grob = NULL,
angle = 30, length = unit(0.25, "inches"),
ends = "last", type = "open", name = NULL,
gp = gpar(), draw = TRUE, vp = NULL)
arrowsGrob(x = c(0.25, 0.75), y = 0.5, default.units = "npc",
grob = NULL,
angle = 30, length = unit(0.25, "inches"),
ends = "last", type = "open", name = NULL,
gp = gpar(), vp = NULL)
参数----------Arguments----------
参数:x
A numeric vector or unit object specifying x-values.
一个数值向量或单位对象指定x值。
参数:y
A numeric vector or unit object specifying y-values.
一个数值向量或单位对象指定的y值。
参数:default.units
A string indicating the default units to use if x or y are only given as numeric vectors.
一个字符串,指示的默认单位使用,如果x或y只为数字向量。
参数:grob
A grob to add arrows to; currently can only be a line.to, lines, or segments grob.
一个GROB添加箭头;目前只能是的line.to,线,或分部GROB。
参数:angle
A numeric specifying (half) the width of the arrow head (in degrees).
一个数字指定(半)箭头头部的宽度(度)。
参数:length
A unit object specifying the length of the arrow head.
A股对象指定箭头的长度。
参数:ends
One of "first", "last", or "both", indicating which end of the line to add arrow heads.
一个"first","last"或"both",指示行的末尾添加箭头元首。
参数:type
Either "open" or "closed" to indicate the type of arrow head.
要么"open"或"closed"指示箭头的类型。
参数:name
A character identifier.
字符识别。
参数:gp
An object of class gpar, typically the output from a call to the function gpar. This is basically a list of graphical parameter settings.
一个类的对象gpar,通常从调用输出函数gpar。这基本上是一个图形参数设置列表。
参数:draw
A logical value indicating whether graphics output should be produced.
一个逻辑值,指示是否应当制作图形输出。
参数:vp
A Grid viewport object (or NULL).
一个网格视口对象(或NULL)。
Details
详情----------Details----------
Both functions create an arrows grob (a graphical object describing arrows), but only grid.arrows() draws the arrows (and then only if draw is TRUE).
这两个函数创建一个箭头的GROB(图形对象描述箭头),但只有grid.arrows()绘制箭头(然后只有draw是TRUE)。
If the grob argument is specified, this overrides any x and/or y arguments.
如果GROB指定参数,覆盖任何x和/或Y参数。
值----------Value----------
An arrows grob. grid.arrows() returns the value invisibly.
一个箭头GROB。 grid.arrows()返回无形的价值。
作者(S)----------Author(s)----------
Paul Murrell
参见----------See Also----------
Grid, viewport, grid.line.to, grid.lines, grid.segments
电网,viewport,grid.line.to,grid.lines,grid.segments
举例----------Examples----------
## Not run: ## to avoid lots of deprecation warnings[#无法运行:##,以避免大量的过时的警告]
pushViewport(viewport(layout=grid.layout(2, 4)))
pushViewport(viewport(layout.pos.col=1,
layout.pos.row=1))
grid.rect(gp=gpar(col="grey"))
grid.arrows()
popViewport()
pushViewport(viewport(layout.pos.col=2,
layout.pos.row=1))
grid.rect(gp=gpar(col="grey"))
grid.arrows(angle=15, type="closed")
popViewport()
pushViewport(viewport(layout.pos.col=3,
layout.pos.row=1))
grid.rect(gp=gpar(col="grey"))
grid.arrows(angle=5, length=unit(0.1, "npc"),
type="closed", gp=gpar(fill="white"))
popViewport()
pushViewport(viewport(layout.pos.col=4,
layout.pos.row=1))
grid.rect(gp=gpar(col="grey"))
grid.arrows(x=unit(0:80/100, "npc"),
y=unit(1 - (0:80/100)^2, "npc"))
popViewport()
pushViewport(viewport(layout.pos.col=1,
layout.pos.row=2))
grid.rect(gp=gpar(col="grey"))
grid.arrows(ends="both")
popViewport()
pushViewport(viewport(layout.pos.col=2,
layout.pos.row=2))
grid.rect(gp=gpar(col="grey"))
# Recycling arguments[回收的论据]
grid.arrows(x=unit(1:10/11, "npc"), y=unit(1:3/4, "npc"))
popViewport()
pushViewport(viewport(layout.pos.col=3,
layout.pos.row=2))
grid.rect(gp=gpar(col="grey"))
# Drawing arrows on a segments grob[借鉴段GROB上的箭头]
gs <- segmentsGrob(x0=unit(1:4/5, "npc"),
x1=unit(1:4/5, "npc"))
grid.arrows(grob=gs, length=unit(0.1, "npc"),
type="closed", gp=gpar(fill="white"))
popViewport()
pushViewport(viewport(layout.pos.col=4,
layout.pos.row=2))
grid.rect(gp=gpar(col="grey"))
# Arrows on a lines grob[箭头上的一句台词GROB]
# Name these because going to grid.edit them later[等等这些,因为以后grid.edit]
gl <- linesGrob(name="curve", x=unit(0:80/100, "npc"),
y=unit((0:80/100)^2, "npc"))
grid.arrows(name="arrowOnLine", grob=gl, angle=15, type="closed",
gp=gpar(fill="black"))
popViewport()
pushViewport(viewport(layout.pos.col=1,
layout.pos.row=2))
grid.move.to(x=0.5, y=0.8)
popViewport()
pushViewport(viewport(layout.pos.col=4,
layout.pos.row=1))
# Arrows on a line.to grob[箭头1 line.to GROB]
glt <- lineToGrob(x=0.5, y=0.2, gp=gpar(lwd=3))
grid.arrows(grob=glt, ends="first", gp=gpar(lwd=3))
popViewport(2)
grid.edit(gPath("arrowOnLine", "curve"), y=unit((0:80/100)^3, "npc"))
## End(Not run)[#结束(不运行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|