Debian Codegraph @

man/n.plot.Rd

raw
1 \name{n.plot}
2 \alias{n.plot}
3 \title{Name Plot: Names or Numbers instead of Points in Plot}
4 \description{
5 A utility function which basically calls \code{\link{plot}(*, type="n")}
6 and \code{\link{text}}. To have names or numbers instead of points
7 in a plot is useful for identifaction, e.g., in a residual plot, see
8 also \code{\link{TA.plot}}.
9 }
10 \usage{
11 n.plot(x, y = NULL, nam = NULL, abbr = n >= 20 || max(nchar(nam))>=8,
12 type = "n", xlab = NULL, ylab = NULL, log = "",
13 cex = par("cex"), col = par("col"), pt.col = par("col"), \dots)
14 }
15 \arguments{
16 \item{x, y}{coordinates at which to plot. If \code{y} is missing,
17 \code{x} is used for both, if it's a \code{\link{data.frame},
18 \link{list}}, 2-column matrix etc -- via \code{\link{xy.coords}};
19 formula do \bold{not} work.}
20 \item{nam}{the labels to plot at each (x,y). Per default, these
21 taken from the data \code{x} and \code{y}; case numbers \code{1:n}
22 are taken if no names are available.}
23 \item{abbr}{logical indicating if the \code{nam} labels should be
24 abbreviated -- with a sensible default.}
25 \item{type}{passed to \code{plot.default},a string denoting the type of
26 the initial \code{\link{plot}()} call; the default draws nothing but
27 the axes, etc; \code{type = "l"} maybe useful occasionally.}
28 \item{xlab, ylab}{labels for the x- and y- axis, the latter being empty
29 by default.}
30 \item{log}{character specifying if log scaled axes should be used, see
31 \code{\link{plot.default}}.}
32 \item{cex}{plotting character expansion, see \code{\link{par}}.}
33 \item{col}{color to use for \code{\link{text}()}.}
34 \item{pt.col}{color to use for \code{\link{plot}()} \emph{if} \code{type} is
35 set different to \code{"n"}.}
36 \item{\dots}{further arguments to be passed to the \code{\link{plot}} call.}
37 }
38 \value{
39 invisibly, a character vector with the labels used.
40 }
41 \author{Martin Maechler, since 1992}
42 \seealso{\code{\link{plot.default}}, \code{\link{text}}.}
43 \examples{
44 n.plot(1:20, cumsum(rnorm(20)))
45 data(cars)
46 with(cars, n.plot(speed, dist, cex = 0.8, col = "forest green"))
47
48 ## visualize periodicity of exp(<complex>) {pass args to plot.default() via `...`}
49 cpxN <- function(r,i) setNames(complex(real=r, imaginary=i), i)
50 n.plot(exp(cpxN(2, 0:32)), type = "l", pt.col = "gray", asp = 1,
51 col = adjustcolor(rainbow(33), offset = rep(-1/4, 4)),
52 panel.first = abline(h=0, v=0, lty=3, col="gray30"))
53 symbols(0,0, circles = exp(2), inches=FALSE, fg = adjustcolor(2, 1/3), lwd=3, add=TRUE)
54 }
55 \keyword{hplot}