-
Notifications
You must be signed in to change notification settings - Fork 8
/
bplot.html
143 lines (117 loc) · 4.74 KB
/
bplot.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: boxplot</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="R.css" />
</head><body>
<table width="100%" summary="page for bplot {fields}"><tr><td>bplot {fields}</td><td style="text-align: right;">R Documentation</td></tr></table>
<h2>
boxplot
</h2>
<h3>Description</h3>
<p>Plots boxplots of several groups of data
and allows for placement at different horizontal or vertical positions or
colors. It
is also flexible in the input object, accepting either a list or matrix.
</p>
<h3>Usage</h3>
<pre>
bplot(x, by, pos=NULL, at = pos, add = FALSE, boxwex =
0.8,xlim=NULL, ...)
</pre>
<h3>Arguments</h3>
<table summary="R argblock">
<tr valign="top"><td><code>x</code></td>
<td>
<p>Vector, matrix, list or data frame. A vector may be divided according
to the by argument. Matrices and data frames are separated by columns and
lists by components.
</p>
</td></tr>
<tr valign="top"><td><code>by</code></td>
<td>
<p>If x is a vector, an optional vector (either character or numerical)
specifying the categories to divide x into separate data sets. Boxplots are then made
for each group.
</p>
</td></tr>
<tr valign="top"><td><code>pos</code></td>
<td>
<p>The boxplots will be plotted vertically (horizontally) and pos gives the x (y) locations for their centers. If omitted the boxes are equally spaced at integer
values. This is the same as <code>at</code> in the <code>boxplot</code> function
</p>
</td></tr>
<tr valign="top"><td><code>at</code></td>
<td>
<p>Same as <code>pos</code> this is the name for this argument in the standard <code>boxplot</code> function.</p>
</td></tr>
<tr valign="top"><td><code>add</code></td>
<td>
<p>If true, do not create a new plots just add the boxplots to a current
plot. Note that the pos argument may be useful in this case and should
be in the user coordinates of the parent plot.</p>
</td></tr>
<tr valign="top"><td><code>boxwex</code></td>
<td>
<p>A boxplot argument to control the width of the boxplot.
It behaves a little different than as an argumetn passed directly to <code>boxplot</code>.
To make this a general function it is useful to scale this according to size of positions. Within bplot this happens as <code>boxwex<- boxwex* min(diff( sort( at)))</code>.
and then the scaled version of <code>boxwex</code> is now passed to <code>boxplot</code>.</p>
</td></tr>
<tr valign="top"><td><code>xlim</code></td>
<td>
<p> Same as the usual argument used in plotting. The plotting limits for the
x axis. </p>
</td></tr>
<tr valign="top"><td><code>...</code></td>
<td>
<p>Other arguments to be passed to the boxplot function some handy favorites are:
<code>names</code>
Labels for each boxplot.
<code>horizontal</code>If TRUE draw boxplots horizontally the default is false, produce
vertical box plots.
<code>lwd</code>Width(s) of lines in box plots.
<code>col</code>Color(s) of bplots. See <code>colors()</code> for some choices.</p>
</td></tr>
</table>
<h3>Details</h3>
<p>This function was created as a complement to the usual S/R function for
boxplots. The current function makes it possible to put the boxplots
at unequal x or y positions in a rational way using the <code>at</code> or
<code>pos</code> arguments. This is useful for visually grouping a large set
of boxplots into several groups. Also placement of the boxplots with
respect to the axis can add information to the plot. Another aspect
is the emphasis on data structures for groups of data. One useful
feature is the by option to break up the x vector into distinct
groups.
</p>
<p>Use <code>axis(3)</code> (<code>axis(4)</code>) to add an axis along the top (right side) or omit the category names and draw on the
bottom <code>axis(1)</code> (left side <code>axis(2)</code>).
</p>
<p>The older <code>bplot</code> function drew the boxplots from scratch and if
one needs to do this refer to the old functions: <code>
describe.bplot, draw.bplot.obj, bplot.xy, bplot.obj</code>
</p>
<p>Finally to bin data into groups based on a continuous variable and to
make bplots of each group see <code>bplot.xy</code>.
</p>
<h3>See Also</h3>
<p> bplot.xy </p>
<h3>Examples</h3>
<pre>
#
set.seed(123)
temp<- matrix( rnorm(12*8), ncol=12)
pos<- c(1:6,9, 12:16)*100
bplot(temp)
#
par(las=2)
bplot( temp, pos=pos, names=paste( "Data",1:12, sep=""))
# add an axis along top for reference
axis(3)
#
# Xmas boxplots in pleasing red and green
bplot( temp, pos=pos, col=c("red4", "green4"))
# add an axis on top
axis( 3)
</pre>
<hr /><div style="text-align: center;">[Package <em>fields</em> version 9.9 <a href="00Index.html">Index</a>]</div>
</body></html>