找回密码
 注册
查看: 21566|回复: 0

R语言:axis()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-2-16 18:25:05 | 显示全部楼层 |阅读模式
axis(graphics)
axis()所属R语言包:graphics

                                        Add an Axis to a Plot
                                         添加轴图

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

Adds an axis to the current plot, allowing the specification of the side, position, labels, and other options.
增加了一个轴当前的图,使侧,位置,标签,和其他选项的规范。


用法----------Usage----------


axis(side, at = NULL, labels = TRUE, tick = TRUE, line = NA,
     pos = NA, outer = FALSE, font = NA, lty = "solid",
     lwd = 1, lwd.ticks = lwd, col = NULL, col.ticks = NULL,
     hadj = NA, padj = NA, ...)



参数----------Arguments----------

参数:side
an integer specifying which side of the plot the axis is to be drawn on.  The axis is placed as follows: 1=below, 2=left, 3=above and 4=right.
一个整数,指定轴是哪一方的图要绘制。轴放置如下:1 = 2 =左,3 =上述4 =右。


参数:at
the points at which tick-marks are to be drawn.  Non-finite (infinite, NaN or NA) values are omitted.  By default (when NULL) tickmark locations are computed, see "Details" below.
点绘制刻度标记。非有限(无限NaN或NA)值被省略。默认情况下(NULL)对勾标记的位置计算时,请参阅下面的“详细资料”。


参数:labels
this can either be a logical value specifying whether (numerical) annotations are to be made at the tickmarks, or a character or expression vector of labels to be placed at the tickpoints.  (Other objects are coerced by as.graphicsAnnot.) If this is not logical, at should also be supplied and of the same length.  If labels is of length zero after coercion, it has the same effect as supplying TRUE.
这可以是一个逻辑值,指定(数值)注释是否要在tickmarks,或标签被放置在tickpoints字符或表达向量。 (其它物体被强制as.graphicsAnnot。)如果这是不符合逻辑的,at应该也可以提供相同长度的。如果labels长度为零的胁迫后,它具有相同的效果,提供TRUE。


参数:tick
a logical value specifying whether tickmarks and an axis line should be drawn.
应制定一个逻辑值,指定无论是tickmarks轴线。


参数:line
the number of lines into the margin at which the axis line will be drawn, if not NA.
行成的保证金数量将绘制轴线,如果不是NA。


参数:pos
the coordinate at which the axis line is to be drawn: if not NA this overrides the value of line.
坐标绘制轴线是:如果没有NA覆盖line的值。


参数:outer
a logical value indicating whether the axis should be drawn in the outer plot margin, rather than the standard plot margin.
一个逻辑值,指示是否应外积保证金,而不是标准的图保证金绘制轴。


参数:font
font for text.  Defaults to par("font").
文本的字体。 par("font")默认。


参数:lty
line type for both the axis line and the tick marks.
轴线和刻度线类型。


参数:lwd, lwd.ticks
line widths for the axis line and the tick marks. Zero or negative values will suppress the line or ticks.
轴线和刻度线的宽度。零或负值,将抑制线或刻度线。


参数:col, col.ticks
colors for the axis line and the tick marks respectively.  col = NULL means to use par("fg"), possibly specified inline, and col.ticks = NULL means to use whatever color col resolved to.
轴线和刻度线的颜色分别标志着。 col = NULL意味着使用par("fg")可能指定的内联,和col.ticks = NULL意味着使用什么颜色col解决。


参数:hadj
adjustment (see par("adj")) for all labels parallel ("horizontal") to the reading direction.  If this is not a finite value, the default is used (centring for strings parallel to the axis, justification of the end nearest the axis otherwise).
调整(见par("adj"))(水平)的阅读方向平行的所有标签。如果这不是一个有限值,则使用默认值(围绕弦轴平行,最近的轴,否则年底的理由)。


参数:padj
adjustment for each tick label perpendicular to the reading direction.  For labels parallel to the axes, padj=0 means right or top alignment, and padj=1 means left or bottom alignment.  This can be a vector given a value for each string, and will be recycled as necessary.  If padj is not a finite value (the default), the value of par("las") determines the adjustment.  For strings plotted perpendicular to the axis the default is to centre the string.
每个刻度标签的阅读方向垂直的调整。平行轴的标签,padj=0是指权利或顶部对齐,padj=1是指左侧或底部对齐。这可以是一个向量,每个字符串值,将在必要时回收。如果padj是不是一个有限值(默认)值par("las")决定调整。对于字符串绘制垂直轴默认为中心的字符串。


参数:...
other graphical parameters may also be passed as arguments to this function, particularly, cex.axis, col.axis and font.axis for axis annotation, mgp and xaxp or yaxp for positioning, tck or tcl for tick mark length and direction, las for vertical/horizontal label orientation, or fg instead of col, and xpd for clipping.  See par on these.  Parameters xaxt (sides 1 and 3) and yaxt (sides 2 and 4) control if the axis is plotted at all.  Note that lab will partial match to argument labels unless the latter is also supplied.  (Since the default axes have already been set up by plot.window, lab will not be acted on by axis.)
其他图形的参数,也可能被作为参数传递给这个函数,特别是cex.axis,col.axis和font.axis轴注释,mgp和xaxp或yaxp定位,tck或tcl刻度的长度和方向,las垂直/水平方向标签,或fg而不是col xpd的剪报。看到par这些。 xaxt(双方1和3)和yaxt(双方2和4)的控制,如果轴绘制在所有参数。注意lab将部分匹配参数labels除非后者还提供了。 (由于默认的轴已经被设置plot.window,lab不会采取行动axis。)


Details

详情----------Details----------

The axis line is drawn from the lowest to the highest value of at, but will be clipped at the plot region.  By default, only ticks which are drawn from points within the plot region (up to a tolerance for rounding error) are plotted, but the ticks and their labels may well extend outside the plot region.  Use xpd=TRUE or xpd=NA to allow axes to extend further.
绘制轴线,从最低到最高值at,但将在积区裁剪。默认情况下,只刻度线图区域内的点(舍入误差公差)绘制的绘制,但图区域以外的刻度线和它们的标签可能延长。使用xpd=TRUE或xpd=NA允许轴的进一步扩大。

When at = NULL, pretty tick mark locations are computed internally (the same way axTicks(side) would) from par("xaxp") or "yaxp" and par("xlog") (or "ylog").  Note that these locations may change if an on-screen plot is resized (for example, if the plot argument asp (see plot.window) is set.)
当at = NULL,漂亮的打勾标记位置计算内部(以同样的方式axTicks(side))par("xaxp")或"yaxp"和par("xlog")("ylog" )。请注意,这些地点可能会改变,如果屏幕上的图大小(例如,如果plot论点asp(plot.window)设置。)

If labels is not specified, the numeric values supplied or calculated for at are converted to character strings as if they were a numeric vector printed by print.default(digits=7).
labels如果不指定,提供或at转换为字符串,好像他们是由print.default(digits=7)印刷数字矢量计算的数值。

The code tries hard not to draw overlapping tick labels, and so will omit labels where they would abut or overlap previously drawn labels. This can result in, for example, every other tick being labelled. (The ticks are drawn left to right or bottom to top, and space at least the size of an "m" is left between labels.)
代码力图绘制重叠的刻度标记,所以会忽略标签,他们将相邻或重叠以前绘制标签。这可能会导致,例如,每一个被贴上其他刻度线。 (刻度线绘制从左右侧或底部到顶部,至少有一个“M”的大小和空间标签之间留下。)

If either line or pos is set, they (rather than par("mgp")[3]) determine the position of the axis line and tick marks, and the tick labels are placed par("mgp")[2] further lines into (or towards for pos) the margin.
如果任一line或pos设置,他们(而不是par("mgp")[3])确定轴线的位置和刻度,刻度标记都放在par("mgp")[2]进一步行(或对为pos)的保证金。

Several of the graphics parameters affect the way axes are drawn. The vertical (for sides 1 and 3) positions of the axis and the tick labels are controlled by mgp[2:3] and mex, the size and direction of the ticks is controlled by tck and tcl and the appearance of the tick labels by cex.axis, col.axis and font.axis with orientation controlled by las (but not srt, unlike S which uses srt if at is supplied and las if it is not).  Note that adj is not supported and labels are always centered.  See par for details.
几个图形参数的影响轴的绘制方式。垂直(双方1和3)轴的刻度标记的位置控制mgp[2:3]和mex,刻度线的大小和方向的控制tck和tcl和外观的刻度标记cex.axis,col.axis和font.axislas(但不srt,不像小号使用控制方向srt如果at提供las如果不是)。注意adj不支持和标签总是集中。看到par详情。


值----------Value----------

The numeric locations on the axis scale at which tick marks were drawn when the plot was first drawn (see "Details").
轴刻度的刻度得出当剧情首次绘制(见“详细资料”)的数字位置。

This function is usually invoked for its side effect, which is to add an axis to an already existing plot.
这个函数通常调用其副作用,这是添加一个轴到一个已经存在的图。


参考文献----------References----------

The New S Language. Wadsworth & Brooks/Cole.

参见----------See Also----------

Axis for a generic interface.
Axis为一个通用的接口。

axTicks returns the axis tick locations corresponding to at=NULL; pretty is more flexible for computing pretty tick coordinates and does not depend on (nor adapt to) the coordinate system in use.
axTicks返回相应的轴刻度位置at=NULLpretty是更灵活的计算漂亮刻度线协调和不依赖于()中使用的坐标系统也不适应。

Several graphics parameters affecting the appearance are documented in par.
影响外观的几个图形参数都记录在par。


举例----------Examples----------


require(stats) # for rnorm[为rnorm]
plot(1:4, rnorm(4), axes = FALSE)
axis(1, 1:4, LETTERS[1:4])
axis(2)
box() #- to make it look "as usual"[ - 让看起来“像往常一样”]

plot(1:7, rnorm(7), main = "axis() examples",
     type = "s", xaxt = "n", frame = FALSE, col = "red")
axis(1, 1:7, LETTERS[1:7], col.axis = "blue")
# unusual options:[不寻常的选项:]
axis(4, col = "violet", col.axis="dark violet", lwd = 2)
axis(3, col = "gold", lty = 2, lwd = 0.5)

# one way to have a custom x axis[有一个自定义X轴的单程]
plot(1:10, xaxt = "n")
axis(1, xaxp=c(2, 9, 7))

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-1-23 21:26 , Processed in 0.028141 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表