sunflowerplot {graphics} | R Documentation |
Multiple points are plotted as ‘sunflowers’ with multiple leaves (‘petals’) such that overplotting is visualized instead of accidental and invisible.
sunflowerplot(x, ...)
## Default S3 method:
sunflowerplot(x, y = NULL, number, log = "", digits = 6,
xlab = NULL, ylab = NULL, xlim = NULL, ylim = NULL,
add = FALSE, rotate = FALSE,
pch = 16, cex = 0.8, cex.fact = 1.5,
col = par("col"), bg = NA, size = 1/8, seg.col = 2,
seg.lwd = 1.5, ...)
## S3 method for class 'formula'
sunflowerplot(formula, data = NULL, xlab = NULL, ylab = NULL, ...,
subset, na.action = NULL)
x |
numeric vector of |
y |
numeric vector of |
number |
integer vector of length |
log |
character indicating log coordinate scale, see
|
digits |
when |
xlab, ylab |
character label for x-, or y-axis, respectively. |
xlim, ylim |
|
add |
logical; should the plot be added on a previous one ?
Default is |
rotate |
logical; if |
pch |
plotting character to be used for points
( |
cex |
numeric; character size expansion of center points
(s. |
cex.fact |
numeric shrinking factor to be used for the
center points when there are flower leaves,
i.e., |
col, bg |
colors for the plot symbols, passed to
|
size |
of sunflower leaves in inches, 1[in] := 2.54[cm]. Default: 1/8\", approximately 3.2mm. |
seg.col |
color to be used for the segments which make the
sunflowers leaves, see |
seg.lwd |
numeric; the line width for the leaves' segments. |
... |
further arguments to |
formula |
a |
data |
a data.frame (or list) from which the variables in
|
subset |
an optional vector specifying a subset of observations to be used in the fitting process. |
na.action |
a function which indicates what should happen
when the data contain |
This is a generic function with default and formula methods.
For number[i] == 1
, a (slightly enlarged) usual plotting symbol
(pch
) is drawn. For number[i] > 1
, a small plotting
symbol is drawn and number[i]
equi-angular ‘rays’
emanate from it.
If rotate = TRUE
and number[i] >= 2
, a random direction
is chosen (instead of the y-axis) for the first ray. The goal is to
jitter
the orientations of the sunflowers in order to
prevent artefactual visual impressions.
A list with three components of same length,
x |
x coordinates |
y |
y coordinates |
number |
number |
Use xyTable()
(from package
grDevices) if you are only interested in this return value.
A scatter plot is drawn with ‘sunflowers’ as symbols.
Andreas Ruckstuhl, Werner Stahel, Martin Maechler, Tim Hesterberg, 1989–1993. Port to R by Martin Maechler maechler@stat.math.ethz.ch.
Chambers, J. M., Cleveland, W. S., Kleiner, B. and Tukey, P. A. (1983). Graphical Methods for Data Analysis. Wadsworth.
Schilling, M. F. and Watkins, A. E. (1994). A suggestion for sunflower plots. The American Statistician, 48, 303–305. doi:10.2307/2684839.
Murrell, P. (2005). R Graphics. Chapman & Hall/CRC Press.
require(stats) # for rnorm
require(grDevices)
## 'number' is computed automatically:
sunflowerplot(iris[, 3:4])
## Imitating Chambers et al, p.109, closely:
sunflowerplot(iris[, 3:4], cex = .2, cex.fact = 1, size = .035, seg.lwd = .8)
## or
sunflowerplot(Petal.Width ~ Petal.Length, data = iris,
cex = .2, cex.fact = 1, size = .035, seg.lwd = .8)
sunflowerplot(x = sort(2*round(rnorm(100))), y = round(rnorm(100), 0),
main = "Sunflower Plot of Rounded N(0,1)")
## Similarly using a "xyTable" argument:
xyT <- xyTable(x = sort(2*round(rnorm(100))), y = round(rnorm(100), 0),
digits = 3)
utils::str(xyT, vec.len = 20)
sunflowerplot(xyT, main = "2nd Sunflower Plot of Rounded N(0,1)")
## A 'marked point process' {explicit 'number' argument}:
sunflowerplot(rnorm(100), rnorm(100), number = rpois(n = 100, lambda = 2),
main = "Sunflower plot (marked point process)",
rotate = TRUE, col = "blue4")