overplot.html
4.84 KB
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>R: Plot multiple variables on the same region, with appropriate axes</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../R.css">
</head><body>
<table width="100%" summary="page for overplot {gplots}"><tr><td>overplot {gplots}</td><td align="right">R Documentation</td></tr></table>
<h2>Plot multiple variables on the same region, with appropriate axes</h2>
<h3>Description</h3>
<p>
<code>overplot</code> graphs a set of variables defined on the same x-range
but which have varying y-ranges on the same plotting area. For each
set of y-values it uses a different color and line-type and and draws
a correspondingly colored and line-typed axis. <code>panel.overplot</code>
is used by <code>overplot</code> to draw the individual graphs.
</p>
<h3>Usage</h3>
<pre>
overplot(formula, data = parent.frame(), same.scale = FALSE, xlab, ylab,
xlim, ylim, min.y, max.y, log = "", panel = "panel.overplot",
subset, plot = TRUE, groups, main, f = 2/3, ...)
</pre>
<h3>Arguments</h3>
<table summary="R argblock">
<tr valign="top"><td><code>formula</code></td>
<td>
Formula describing the x and y variables. It should be
of the form x ~ y|z. The conditioning variable (z) should be a factor.</td></tr>
<tr valign="top"><td><code>same.scale</code></td>
<td>
Logical value indicating whether the plot region
should have the same range for all plots. Defaults to <code>FALSE</code>.</td></tr>
<tr valign="top"><td><code>xlab, ylab, xlim, ylim, main</code></td>
<td>
Standard plotting parameters. See
<code><a href="../../base/html/plot.html">plot</a></code> for details</td></tr>
<tr valign="top"><td><code>min.y, max.y</code></td>
<td>
Scalar or vector values used to specify the y
plotting limits for individual plots. If a single scalar value is
provided, it will be used for all plots. These parameters can be
used specify one end of the individual plot ranges, while allowing
the other end to vary with the data. EG, to force 0 to always be
within the plot region.</td></tr>
<tr valign="top"><td><code>log</code></td>
<td>
character string '', 'x', 'y', or 'xy', indicating which axes
should be plotted on a log scale. Defaults to '' (neither).</td></tr>
<tr valign="top"><td><code>panel</code></td>
<td>
a plotting function to be called to draw the individual
plots. Defaults to <code>overplot.panel</code>, which plots the points
and a <code>lowess</code> smooth. </td></tr>
<tr valign="top"><td><code>plot</code></td>
<td>
Logical value indicating whether to draw the plot.</td></tr>
<tr valign="top"><td><code>groups</code></td>
<td>
(optional) character vector giving the names of levels
of the conditioning variable to plot. Defaults to all levels of the
conditioning variable.</td></tr>
<tr valign="top"><td><code>f</code></td>
<td>
Smoothing parameter for <code>lowess</code></td></tr>
<tr valign="top"><td><code>data, subset, ...</code></td>
<td>
parameters passed to <code>model.frame</code> to
obtain the data to be plotted from the formula.</td></tr>
</table>
<h3>Details</h3>
<p>
This function essentially performs
</p>
<p>
tmp <- split(data, z)
</p>
<p>
for(i in levels(z))
</p>
<p>
plot( x ~ y, data=tmp[[z]] )
</p>
<p>
except that all of the plots are shown on the same plotting region and
varying scales for each value of z are handled nicely.
</p>
<h3>Value</h3>
<p>
A copy of the data split by the conditioning variable.</p>
<h3>Author(s)</h3>
<p>
Gregory R. Warnes <a href="mailto:warnes@bst.rochester.edu">warnes@bst.rochester.edu</a>
</p>
<h3>See Also</h3>
<p>
<code><a href="../../base/html/interaction.plot.html">interaction.plot</a></code>,
<code><a href="../../base/html/coplot.html">coplot</a></code> for alternative visualizations of 3-way data.
</p>
<h3>Examples</h3>
<pre>
# Example teratogenicity rtPCR data
data(rtPCR)
# same scale
overplot( RQ ~ Conc..ug.ml. | Test.Substance,
data=rtPCR,
subset=Detector=="ProbeType 7" & Conc..ug.ml. > 0,
same.scale=TRUE,
log="xy",
f=3/4,
main="Detector=ProbeType 7",
xlab="Concentration (ug/ml)",
ylab="Relative Gene Quantification"
)
# different scales, but force lower limit to 0.01
overplot( RQ ~ Conc..ug.ml. | Test.Substance,
data=rtPCR,
subset=Detector=="ProbeType 7" & Conc..ug.ml. > 0,
log="xy",
f=3/4,
main="Detector=ProbeType 7",
xlab="Concentration (ug/ml)",
ylab="Relative Gene Quantification",
min.y=0.01
)
</pre>
<hr><div align="center">[Package <em>gplots</em> version 2.3.2 <a href="00Index.html">Index]</a></div>
</body></html>