plot
method for an object of class c("nnt")
.
# S3 method for nnt
plot(x, ...)
Nothing is returned.
See the examples in nnt
.
This function is only applicable in 1 or 2 dimensions, that is,
when ncol(x$data)
= 1 or 2. It provides a visual check that the
wrapping of variables is working as intended, in cases where the
number of query points, that is, nrow(x$query)
is small
enough that sets of nearest neighbours do not overlap much.
If ncol(x$data)
= 1 then the index of each observation is plotted
against its value, using a plotting character pch = 1
. A vertical
line is superimposed at each value in x$query
and the x$k$
nearest neighbours of each line are colour-coded.
If ncol(x$data)
= 2 then x$data[, 2]
is plotted against
x$data[, 1]
, using a plotting character pch = 1
. Each point
in x$query
is plotted with a cross and the x$k$
nearest neighbours of each point are colour-coded.
Colours of the lines/crosses and nearest neighbour points can be set sing an
argument col
. If a variable is wrapped then the default plotting
limits are set using the corresponding values in x$ranges
.
nnt
for nearest neighbour with some variables
wrapped on a torus.