symbols(graphics)
symbols()所属R语言包:graphics
Draw Symbols (Circles, Squares, Stars, Thermometers, Boxplots)
绘制符号(圆形,方形,星,温度计,盒状图)
译者:生物统计家园网 机器人LoveR
描述----------Description----------
This function draws symbols on a plot. One of six symbols; circles, squares, rectangles, stars, thermometers, and boxplots, can be plotted at a specified set of x and y coordinates. Specific aspects of the symbols, such as relative size, can be customized by additional parameters.
此函数绘制在一块土地上的符号。其中6个符号;圆形,方形,长方形,明星,温度计,盒状图,可以在指定的一组x和y坐标绘制。具体方面的符号,如相对大小,可定制的附加参数。
用法----------Usage----------
symbols(x, y = NULL, circles, squares, rectangles, stars,
thermometers, boxplots, inches = TRUE, add = FALSE,
fg = par("col"), bg = NA,
xlab = NULL, ylab = NULL, main = NULL,
xlim = NULL, ylim = NULL, ...)
参数----------Arguments----------
参数:x, y
the x and y co-ordinates for the centres of the symbols. They can be specified in any way which is accepted by xy.coords.
X和Y的符号中心的统筹。他们可以在任何接受的方式,这是由xy.coords指定。
参数:circles
a vector giving the radii of the circles.
向量圆的半径。
参数:squares
a vector giving the length of the sides of the squares.
广场两侧的长度向量。
参数:rectangles
a matrix with two columns. The first column gives widths and the second the heights of rectangles.
一个具有两列的矩阵。第一列的宽度和矩形的第二个高峰。
参数:stars
a matrix with three or more columns giving the lengths of the rays from the center of the stars. NA values are replaced by zeroes.
给三个或更多列射线的长度从分中心的矩阵。 NA值改为零。
参数:thermometers
a matrix with three or four columns. The first two columns give the width and height of the thermometer symbols. If there are three columns, the third is taken as a proportion: the thermometers are filled (using colour fg) from their base to this proportion of their height. If there are four columns, the third and fourth columns are taken as proportions and the thermometers are filled between these two proportions of their heights. The part of the box not filled in fg will be filled in the background colour (default transparent) given by bg.
三或四列的矩阵。前两列给温度计符号的宽度和高度。如果有三列,第三是作为一个比例:温度计是从他们的基地填写(使用颜色fg)这对他们的身高比例。如果有四列,第三和第四列作为比例,并充满他们的高度这两个比例之间的温度计。 不fg填补了框的一部分将在背景颜色填充(默认透明)bg。
参数:boxplots
a matrix with five columns. The first two columns give the width and height of the boxes, the next two columns give the lengths of the lower and upper whiskers and the fifth the proportion (with a warning if not in [0,1]) of the way up the box that the median line is drawn.
五列的矩阵。前两列给框的宽度和高度上,下两列上下胡须的长度和箱子第五方式中所占的比例(与警告,如果不是在[0,1])中线绘制。
参数:inches
TRUE, FALSE or a positive number. See "Details".
TRUE,FALSE或正数。见“详细资料”。
参数:add
if add is TRUE, the symbols are added to an existing plot, otherwise a new plot is created.
如果addTRUE,符号被添加到现有的图,否则一个新的小区创建的。
参数:fg
colour(s) the symbols are to be drawn in.
是要绘制英寸彩色(S)的符号
参数:bg
if specified, the symbols are filled with colour(s), the vector bg being recycled to the number of symbols. The default is to leave the symbols unfilled.
如果指定填充颜色(S),符号,向量bg被回收符号数。默认是离开符号悬空。
参数:xlab
the x label of the plot if add is not true. Defaults to the deparsed expression used for x.
图X标签add如果是不正确的。默认deparseDx使用的表达。
参数:ylab
the y label of the plot. Unused if add = TRUE.
图的y标签。如果add = TRUE未使用。
参数:main
a main title for the plot. Unused if add = TRUE.
主标题为图。如果add = TRUE未使用。
参数:xlim
numeric vector of length 2 giving the x limits for the plot. Unused if add = TRUE.
图的X限制长度的数字矢量2。如果add = TRUE未使用。
参数:ylim
numeric vector of length 2 giving the y limits for the plot. Unused if add = TRUE.
图的Y限制长度的数字矢量2。如果add = TRUE未使用。
参数:...
graphics parameters can also be passed to this function, as can the plot aspect ratio asp (see plot.window).
图形参数,也可以通过此功能,可以作为图宽高比asp(plot.window)。
Details
详情----------Details----------
Observations which have missing coordinates or missing size parameters are not plotted. The exception to this is stars. In that case, the length of any ray which is NA is reset to zero.
缺少坐标或失踪尺寸参数的观测都没有绘制。唯一的例外是明星。在这种情况下,任何射线,这是NA重置为零的长度。
Argument inches controls the sizes of the symbols. If TRUE (the default), the symbols are scaled so that the largest dimension of any symbol is one inch. If a positive number is given the symbols are scaled to make largest dimension this size in inches (so TRUE and 1 are equivalent). If inches is FALSE, the units are taken to be those of the appropriate axes. (For circles, squares and stars the units of the x axis are used. For boxplots, the lengths of the whiskers are regarded as dimensions alongside width and height when scaling by inches, and are otherwise interpreted in the units of the y axis.)
参数inches控制符号的大小。如果TRUE(默认),符号缩放,使任何符号的最大尺寸是一英寸。如果给定的正数的符号缩放英寸的最大尺寸大小(所以TRUE和1是等价的)。如果inchesFALSE单位采取适当的轴。 (圆形,方形和星对于x轴的单位使用。盒状图,胡须的长度是沿着宽度和高度的尺寸inches扩大,否则在单位解释Y轴)。
Circles of radius zero are plotted at radius one pixel (which is device-dependent). On windows devices circles are plotted at radius at least one pixel as some Windows versions omit smaller circles.
半径为零的圆半径的一个像素(这是依赖于设备)绘制。 windows设备圈半径至少有一个像素绘制在某些Windows版本省略小圆圈。
参考文献----------References----------
The New S Language. Wadsworth & Brooks/Cole.
The Elements of Graphing Data. Monterey, California: Wadsworth.
参见----------See Also----------
stars for drawing stars with a bit more flexibility.
stars绘制星有点更大的灵活性。
If you are thinking about doing "bubble plots" by symbols(*, circles=*), you should really consider using sunflowerplot instead.
如果你正在做“气泡图”symbols(*, circles=*)思维,你应该考虑使用sunflowerplot代替。
举例----------Examples----------
require(stats); require(grDevices)
x <- 1:10
y <- sort(10*runif(10))
z <- runif(10)
z3 <- cbind(z, 2*runif(10), runif(10))
symbols(x, y, thermometers = cbind(.5, 1, z), inches = .5, fg = 1:10)
symbols(x, y, thermometers = z3, inches = FALSE)
text(x,y, apply(format(round(z3, digits=2)), 1, paste, collapse = ","),
adj = c(-.2,0), cex = .75, col = "purple", xpd = NA)
## Note that example(trees) shows more sensible plots![#注意,例如(树)显示更明智的图!]
N <- nrow(trees)
with(trees, {
## Girth is diameter in inches[#周长是直径英寸]
symbols(Height, Volume, circles = Girth/24, inches = FALSE,
main = "Trees' Girth") # xlab and ylab automatically[自动XLab中和ylab]
## Colours too:[#颜色太:]
op <- palette(rainbow(N, end = 0.9))
symbols(Height, Volume, circles = Girth/16, inches = FALSE, bg = 1:N,
fg = "gray30", main = "symbols(*, circles = Girth/16, bg = 1:N)")
palette(op)
})
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|