stars(graphics)
stars()所属R语言包:graphics
Star (Spider/Radar) Plots and Segment Diagrams
星(蜘蛛/雷达)图和分部图
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Draw star plots or segment diagrams of a multivariate data set. With one single location, also draws "spider" (or "radar") plots.
绘制星图或一个多元数据集的分部图。用单一的位置,还提请“蜘蛛”(或“雷达”)的图。
用法----------Usage----------
stars(x, full = TRUE, scale = TRUE, radius = TRUE,
labels = dimnames(x)[[1]], locations = NULL,
nrow = NULL, ncol = NULL, len = 1,
key.loc = NULL, key.labels = dimnames(x)[[2]],
key.xpd = TRUE,
xlim = NULL, ylim = NULL, flip.labels = NULL,
draw.segments = FALSE,
col.segments = 1:n.seg, col.stars = NA, col.lines = NA,
axes = FALSE, frame.plot = axes,
main = NULL, sub = NULL, xlab = "", ylab = "",
cex = 0.8, lwd = 0.25, lty = par("lty"), xpd = FALSE,
mar = pmin(par("mar"),
1.1+ c(2*axes+ (xlab != ""),
2*axes+ (ylab != ""), 1,0)),
add = FALSE, plot = TRUE, ...)
参数----------Arguments----------
参数:x
matrix or data frame of data. One star or segment plot will be produced for each row of x. Missing values (NA) are allowed, but they are treated as if they were 0 (after scaling, if relevant).
矩阵或数据框的数据。每个x行,将产生一星级或部分图。遗漏值(NA)是允许的,但他们的待遇,如果他们分别为0(洗牙后,如果相关)。
参数:full
logical flag: if TRUE, the segment plots will occupy a full circle. Otherwise, they occupy the (upper) semicircle only.
逻辑标志:如果TRUE,部分图将占据一个完整的圆。否则,他们占据了(上)半圆只。
参数:scale
logical flag: if TRUE, the columns of the data matrix are scaled independently so that the maximum value in each column is 1 and the minimum is 0. If FALSE, the presumption is that the data have been scaled by some other algorithm to the range [0, 1].
逻辑标志:TRUE如果,数据矩阵的列独立缩放,以便在每一列的最大值是1,最低为0。如果FALSE,推定该数据已被其他一些算法缩放范围[0, 1]。
参数:radius
logical flag: in TRUE, the radii corresponding to each variable in the data will be drawn.
逻辑标志:TRUE,对应于每个变量在数据的半径将绘制。
参数:labels
vector of character strings for labeling the plots. Unlike the S function stars, no attempt is made to construct labels if labels = NULL.
字符串矢量标记的图。不同于S函数stars,没有试图进行构建如果labels = NULL的标签。
参数:locations
Either two column matrix with the x and y coordinates used to place each of the segment plots; or numeric of length 2 when all plots should be superimposed (for a "spider plot"). By default, locations = NULL, the segment plots will be placed in a rectangular grid.
要么两列矩阵X和Y坐标用来放置每个部分图;或数字长度为2,当所有图应叠加(“蜘蛛图”)。默认情况下,locations = NULL,部分图将被放置在一个长方形的网格。
参数:nrow, ncol
integers giving the number of rows and columns to use when locations is NULL. By default, nrow == ncol, a square layout will be used.
行和列的数量,使用时locations是NULL给整数。默认情况下,nrow == ncol,一个方形的布局将被使用。
参数:len
scale factor for the length of radii or segments.
规模为半径或段长度的因素。
参数:key.loc
vector with x and y coordinates of the unit key.
向量与x和y坐标的单位键。
参数:key.labels
vector of character strings for labeling the segments of the unit key. If omitted, the second component of dimnames(x) is used, if available.
字符串矢量标记单位关键环节。如果省略,dimnames(x)的第二个组成部分,如果可用。
参数:key.xpd
clipping switch for the unit key (drawing and labeling), see par("xpd").
裁剪为单位键(图纸和标签)的开关,看到par("xpd")。
参数:xlim
vector with the range of x coordinates to plot.
向量与x的范围内协调图。
参数:ylim
vector with the range of y coordinates to plot.
向量与y的范围内协调图。
参数:flip.labels
logical indicating if the label locations should flip up and down from diagram to diagram. Defaults to a somewhat smart heuristic.
逻辑说明标签的位置,如果要翻转,从图到图。有些智能启发式的默认值。
参数:draw.segments
logical. If TRUE draw a segment diagram.
逻辑。如果TRUE画线段图。
参数:col.segments
color vector (integer or character, see par), each specifying a color for one of the segments (variables). Ignored if draw.segments = FALSE.
颜色矢量(整数或字符,看到par),每一个段(变量)指定一种颜色。如果draw.segments = FALSE忽略。
参数:col.stars
color vector (integer or character, see par), each specifying a color for one of the stars (cases). Ignored if draw.segments = TRUE.
颜色矢量(整数或字符,看到par),每个颜色指定的明星之一(例)。如果draw.segments = TRUE忽略。
参数:col.lines
color vector (integer or character, see par), each specifying a color for one of the lines (cases). Ignored if draw.segments = TRUE.
颜色矢量(整数或字符,看到par),每个指定颜色的线(件)。如果draw.segments = TRUE忽略。
参数:axes
logical flag: if TRUE axes are added to the plot.
逻辑标志:如果TRUE轴添加到图。
参数:frame.plot
logical flag: if TRUE, the plot region is framed.
逻辑标志:如果TRUE,图区域框架。
参数:main
a main title for the plot.
主标题为图。
参数:sub
a sub title for the plot.
子标题为图。
参数:xlab
a label for the x axis.
为x轴的标签。
参数:ylab
a label for the y axis.
y轴的标签。
参数:cex
character expansion factor for the labels.
字符标签的膨胀系数。
参数:lwd
line width used for drawing.
用于绘制线条的宽度。
参数:lty
line type used for drawing.
用于绘制线类型。
参数:xpd
logical or NA indicating if clipping should be done, see par(xpd = .).
逻辑或NA指示是否应做裁剪,看到par(xpd = .)。
参数:mar
argument to par(mar = *), typically choosing smaller margins than by default.
par(mar = *)的参数,通常比默认情况下,选择较小的利润率。
参数:...
further arguments, passed to the first call of plot(), see plot.default and to box() if frame.plot is true.
进一步的论据,通过第一次调用plot(),看到plot.default和box()如果frame.plot是真实的。
参数:add
logical, if TRUE add stars to current plot.
逻辑,如果TRUE目前积加分。
参数:plot
logical, if FALSE, nothing is plotted.
逻辑,如果FALSE,没有绘制。
Details
详情----------Details----------
Missing values are treated as 0.
遗漏值视为0。
Each star plot or segment diagram represents one row of the input x. Variables (columns) start on the right and wind counterclockwise around the circle. The size of the (scaled) column is shown by the distance from the center to the point on the star or the radius of the segment representing the variable.
每颗恒星的图或线段图表示输入x一行。变量(列)开始逆时针绕了一圈的权利和风力。 (缩放)列的大小是从中央到明星或代表变量的段半径的点的距离。
Only one page of output is produced.
只产生一个输出页面。
值----------Value----------
Returns the locations of the plots in a two column matrix, invisibly when plot=TRUE.
返回两列矩阵的图的位置,无形中时plot=TRUE。
注意----------Note----------
This code started life as spatial star plots by David A. Andrews. See http://www.udallas.edu:8080/~andrews/software/software.html.
此代码开始由戴维·安德鲁斯的生活空间星图。见http://www.udallas.edu:8080/〜安德鲁斯/软件/ software.html。
Prior to 1.4.1, scaling only shifted the maximum to 1, although documented as here.
到1.4.1之前,缩放只转移最大为1,虽然这里记载。
作者(S)----------Author(s)----------
Thomas S. Dye
参考文献----------References----------
The New S Language. Wadsworth & Brooks/Cole.
参见----------See Also----------
symbols for another way to draw stars and other symbols.
symbols另一种方式来绘制恒星和其他符号。
举例----------Examples----------
require(grDevices)
stars(mtcars[, 1:7], key.loc = c(14, 2),
main = "Motor Trend Cars : stars(*, full = F)", full = FALSE)
stars(mtcars[, 1:7], key.loc = c(14, 1.5),
main = "Motor Trend Cars : full stars()",flip.labels=FALSE)
## 'Spider' or 'Radar' plot:[#蜘蛛或雷达的图:]
stars(mtcars[, 1:7], locations = c(0,0), radius = FALSE,
key.loc=c(0,0), main="Motor Trend Cars", lty = 2)
## Segment Diagrams:[#分部图:]
palette(rainbow(12, s = 0.6, v = 0.75))
stars(mtcars[, 1:7], len = 0.8, key.loc = c(12, 1.5),
main = "Motor Trend Cars", draw.segments = TRUE)
stars(mtcars[, 1:7], len = 0.6, key.loc = c(1.5, 0),
main = "Motor Trend Cars", draw.segments = TRUE,
frame.plot=TRUE, nrow = 4, cex = .7)
## scale linearly (not affinely) to [0, 1][#线性缩放(不仿射)[0,1]]
USJudge <- apply(USJudgeRatings, 2, function(x) x/max(x))
Jnam <- row.names(USJudgeRatings)
Snam <- abbreviate(substring(Jnam,1,regexpr("[,.]",Jnam) - 1), 7)
stars(USJudge, labels = Jnam, scale = FALSE,
key.loc = c(13, 1.5), main = "Judge not ...", len = 0.8)
stars(USJudge, labels = Snam, scale = FALSE,
key.loc = c(13, 1.5), radius = FALSE)
loc <- stars(USJudge, labels = NULL, scale = FALSE,
radius = FALSE, frame.plot = TRUE,
key.loc = c(13, 1.5), main = "Judge not ...", len = 1.2)
text(loc, Snam, col = "blue", cex = 0.8, xpd = TRUE)
## 'Segments':[#“分部”:]
stars(USJudge, draw.segments = TRUE, scale = FALSE, key.loc = c(13,1.5))
## 'Spider':[“蜘蛛侠”#:]
stars(USJudgeRatings, locations=c(0,0), scale=FALSE,radius = FALSE,
col.stars=1:10, key.loc = c(0,0), main="US Judges rated")
## Same as above, but with colored lines instead of filled polygons.[#同上,但颜色的线,而不是填充多边形。]
stars(USJudgeRatings, locations=c(0,0), scale=FALSE,radius = FALSE,
col.lines=1:10, key.loc = c(0,0), main="US Judges rated")
## 'Radar-Segments'[#“雷达分部]
stars(USJudgeRatings[1:10,], locations = 0:1, scale=FALSE,
draw.segments = TRUE, col.segments=0, col.stars=1:10,key.loc= 0:1,
main="US Judges 1-10 ")
palette("default")
stars(cbind(1:16,10*(16:1)),draw.segments=TRUE,
main = "A Joke -- do *not* use symbols on 2D data!")
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|