ternaryplot(vcd)
ternaryplot()所属R语言包:vcd
Ternary Diagram
三元相图
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Visualizes compositional, 3-dimensional data in an equilateral triangle.
可视化的成分,3维的数据,在一个等边三角形。
用法----------Usage----------
ternaryplot(x, scale = 1, dimnames = NULL,
dimnames_position = c("corner","edge","none"),
dimnames_color = "black", id = NULL, id_color = "black",
id_just = c("center", "center"),
coordinates = FALSE, grid = TRUE, grid_color = "gray",
labels = c("inside", "outside", "none"),
labels_color = "darkgray", border = "black", bg = "white",
pch = 19, cex = 1, prop_size = FALSE, col = "red",
main = "ternary plot", newpage = TRUE, pop = TRUE, ...)
参数----------Arguments----------
参数:x
a matrix with three columns.
矩阵有三列。
参数:scale
row sums scale to be used.
行求和规模要使用。
参数:dimnames
dimension labels (defaults to the column names of x).
标注标签(默认为列名的x)。
参数:dimnames_position, dimnames_color
position and color of dimension labels.
维标签的位置和颜色。
参数:id
optional labels to be plotted below the plot symbols. coordinates and id are mutual exclusive.
可选的标签,被绘制在图形的下方符号。 coordinates和id是互斥的。
参数:id_color
color of these labels.
这些标签的颜色。
参数:id_just
character vector of length 1 or 2 indicating the justification of these labels.
字符向量长度为1或2表示这些标签的理由。
参数:coordinates
if TRUE, the coordinates of the points are plotted below them. coordinates and id are mutual exclusive.
如果TRUE,点的坐标绘制它们下面。 coordinates和id是互斥的。
参数:grid
if TRUE, a grid is plotted. May optionally be a string indicating the line type (default: "dotted").
如果TRUE,一个网格绘制。可能选择一个字符串,指示线路类型(默认:"dotted")。
参数:grid_color
grid color.
网格颜色。
参数:labels, labels_color
position and color of the grid labels.
网格标签的位置和颜色。
参数:border
color of the triangle border.
颜色三角形的边界。
参数:bg
triangle background.
三角形的背景。
参数:pch
plotting character. Defaults to filled dots.
绘制字符。默认为填充点。
参数:cex
a numerical value giving the amount by which plotting text and symbols should be scaled relative to the default. Ignored for the symbol size if prop_size is not FALSE.
一个数值,绘制文字和符号应扩大相对于默认。 prop_size忽略符号的大小,如果FALSE。
参数:prop_size
if TRUE, the symbol size is plotted proportional to the row sum of the three variables, i.e., represents the weight of the observation.
如果TRUE,符号的大小绘制三个变量的行总和成比例,即,表示观察的重量。
参数:col
plotting color.
绘制的颜色。
参数:main
main title.
主标题。
参数:newpage
if TRUE, the plot will appear on a new graphics page.
如果TRUE,图上会出现一个新的图形页面。
参数:pop
logical; if TRUE, all newly generated viewports are popped after plotting.
逻辑TRUE如果,所有新生成的视口被弹出后绘制。
参数:...
additional graphics parameters (see par)
额外的图形参数(见par)
Details
详细信息----------Details----------
A points' coordinates are found by computing the gravity center of mass points using the data entries as weights. Thus, the coordinates of a point P(a,b,c), a + b + c = 1, are: P(b + c/2, c * sqrt(3)/2).
A点的坐标被发现通过计算质点的重心作为权重,使用的数据条目。因此,一个点的坐标P(a,b,c),a + b + c = 1,是:P(b + c/2, c * sqrt(3)/2)。
(作者)----------Author(s)----------
David Meyer <a href="mailtoavid.Meyer@R-project.org">David.Meyer@R-project.org</a>
参考文献----------References----------
Visualizing Categorical Data. SAS Institute, Cary, NC.
实例----------Examples----------
data("Arthritis")
## Build table by crossing Treatment and Sex[建表的交叉处理和性别]
tab <- as.table(xtabs(~ I(Sex:Treatment) + Improved, data = Arthritis))
## Mark groups[#标记组]
col <- c("red", "red", "blue", "blue")
pch <- c(1, 19, 1, 19)
## plot[#图]
ternaryplot(
tab,
col = col,
pch = pch,
prop_size = TRUE,
bg = "lightgray",
grid_color = "white",
labels_color = "white",
main = "Arthritis Treatment Data"
)
## legend[#传说]
grid_legend(0.8, 0.7, pch, col, rownames(tab), title = "GROUP")
## Titanic[#泰坦尼克号]
data("Lifeboats")
attach(Lifeboats)
ternaryplot(
Lifeboats[,4:6],
pch = ifelse(side == "ort", 1, 19),
col = ifelse(side == "ort", "red", "blue"),
id = ifelse(men / total > 0.1, as.character(boat), NA),
prop_size = 2,
dimnames_position = "edge",
main = "Lifeboats on Titanic"
)
grid_legend(0.8, 0.9, c(1, 19),
c("red", "blue"), c("ort", "Starboard"),
title = "SIDE")
## Hitters[#打者]
data("Hitters")
attach(Hitters)
colors <- c("black","red","green","blue","red","black","blue")
pch <- substr(levels(Positions), 1, 1)
ternaryplot(
Hitters[,2:4],
pch = as.character(Positions),
col = colors[as.numeric(Positions)],
main = "Baseball Hitters Data"
)
grid_legend(0.8, 0.9, pch, colors, levels(Positions),
title = "OSITION(S)")
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|