Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

n.plot

Name Plot: Names or Numbers instead of Points in Plot


Description

A utility function which basically calls plot(*, type="n") and text. To have names or numbers instead of points in a plot is useful for identifaction, e.g., in a residual plot, see also TA.plot.

Usage

n.plot(x, y = NULL, nam = NULL, abbr = n >= 20 || max(nchar(nam))>=8,
       xlab = NULL, ylab = NULL, log = "",
       cex = par("cex"), col = par("col"), ...)

Arguments

x,y

coordinates at which to plot. If y is missing, x is used for both, if it's a data.frame, list, 2-column matrix etc – via xy.coords; formula do not work.

nam

the labels to plot at each (x,y). Per default, these taken from the data x and y; case numbers 1:n are taken if no names are available.

abbr

logical indicating if the nam labels should be abbreviated – with a sensible default.

xlab,ylab

labels for the x- and y- axis, the latter being empty by default.

log

character specifying if log scaled axes should be used, see plot.default.

cex

plotting character expansion, see par.

col

color to use for text().

...

further arguments to be passed to the plot call.

Value

invisibly, a character vector with the labels used.

Author(s)

Martin Maechler, since 1992

See Also

Examples

n.plot(1:20, cumsum(rnorm(20)))
 data(cars)
 with(cars, n.plot(speed, dist, cex = 0.8, col = "forest green"))

sfsmisc

Utilities from 'Seminar fuer Statistik' ETH Zurich

v1.1-11
GPL (>= 2)
Authors
Martin Maechler [aut, cre] (<https://orcid.org/0000-0002-8685-9910>), Werner Stahel [ctb] (Functions: compresid2way(), f.robftest(), last(), p.scales(), p.dnorm()), Andreas Ruckstuhl [ctb] (Functions: p.arrows(), p.profileTraces(), p.res.2x()), Christian Keller [ctb] (Functions: histBxp(), p.tachoPlot()), Kjetil Halvorsen [ctb] (Functions: KSd(), ecdf.ksCI()), Alain Hauser [ctb] (Functions: cairoSwd(), is.whole(), toLatex.numeric()*), Christoph Buser [ctb] (to function Duplicated()), Lorenz Gygax [ctb] (to function p.res.2fact()), Bill Venables [ctb] (Functions: empty.dimnames(), primes()), Tony Plate [ctb] (to inv.seq()), Isabelle Fl<fc>ckiger [ctb], Marcel Wolbers [ctb], Markus Keller [ctb], Sandrine Dudoit [ctb], Jane Fridlyand [ctb], Greg Snow [ctb] (to loessDemo()), Henrik Aa. Nielsen [ctb] (to loessDemo()), Vincent Carey [ctb], Ben Bolker [ctb], Philippe Grosjean [ctb], Fr<e9>d<e9>ric Ibanez [ctb], Caterina Savi [ctb], Charles Geyer [ctb], Jens Oehlschl<e4>gel [ctb]
Initial release
2021-04-03

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.