spider | R Documentation |
Draw a spider plot.
spider(
x = NULL,
y,
group = NULL,
start = NULL,
breaks = NULL,
col = NULL,
lwd = par("lwd"),
lty = par("lty"),
labels = unique(group),
at.labels = NULL,
col.labels = col,
horiz = TRUE,
panel.first = NULL,
panel.last = NULL,
...
)
x, y |
numeric vectors of data; note that |
group |
a vector defining groups |
start |
an optional vector of length 1 or 2 giving the starting
values for |
breaks |
a vector of cut points for |
col, lwd, lty |
if |
labels |
optional labels for each group, plotted at the last value
of |
at.labels, col.labels |
vectors of x-coordinates and colors for each group label |
horiz |
logical; if |
panel.first, panel.last |
expressions to be evaluated before or after plotting takes place |
... |
additional arguments passed to |
## basic usage
spider(y = airquality$Temp[airquality$Day == 1])
with(airquality, spider(Day[Month == 5], Temp[Month == 5]))
## with groups
with(airquality, spider(Day, Temp, group = Month))
with(airquality, spider(Day, Temp - mean(Temp), group = Month, start = 0))
with(airquality, {
spider(Day, Temp - mean(Temp), group = Month, start = 0,
labels = month.abb[unique(Month)],
at.labels = par('usr')[2], col.labels = 1:5)
})
## with breaks
br <- c(0, 70, 80, 90, 120)
cc <- c('black', 'yellow', 'orange', 'red')
spider(
y = airquality$Temp, breaks = br, col = cc, ylim = c(50, 100),
xlab = 'Time from start', ylab = 'Temperature',
bty = 'l', las = 1L, lwd = 2, labels = 'Current',
panel.first = {
p <- par('usr')
rect(p[1], br[-length(br)], p[2], br[-1],
col = adjustcolor(cc, 0.1), border = NA)
},
panel.last = {
points(airquality$Temp, pch = 18,
col = ifelse(airquality$Temp > 90, 2, NA))
points(nrow(airquality), airquality$Temp[nrow(airquality)], pch = 18)
}
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.