File: matrixplot.Rd

package info (click to toggle)
r-cran-vim 6.2.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,556 kB
  • sloc: cpp: 141; sh: 12; makefile: 2
file content (151 lines) | stat: -rw-r--r-- 5,857 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/matrixplot.R
\name{matrixplot}
\alias{matrixplot}
\alias{TKRmatrixplot}
\alias{iimagMiss}
\title{Matrix plot}
\usage{
matrixplot(
  x,
  delimiter = NULL,
  sortby = NULL,
  col = c("red", "orange"),
  fixup = TRUE,
  xlim = NULL,
  ylim = NULL,
  main = NULL,
  sub = NULL,
  xlab = NULL,
  ylab = NULL,
  axes = TRUE,
  labels = axes,
  xpd = NULL,
  interactive = TRUE,
  ...
)
}
\arguments{
\item{x}{a matrix or \code{data.frame}.}

\item{delimiter}{a character-vector to distinguish between variables and
imputation-indices for imputed variables (therefore, \code{x} needs to have
\code{\link[=colnames]{colnames()}}). If given, it is used to determine the corresponding
imputation-index for any imputed variable (a logical-vector indicating which
values of the variable have been imputed). If such imputation-indices are
found, they are used for highlighting and the colors are adjusted according
to the given colors for imputed variables (see \code{col}).}

\item{sortby}{a numeric or character value specifying the variable to sort
the data matrix by, or \code{NULL} to plot without sorting.}

\item{col}{the colors to be used in the plot.  RGB colors may be specified
as character strings or as objects of class "\code{\link[colorspace:RGB]{colorspace::RGB()}}".
HCL colors need to be specified as objects of class
"\code{\link[colorspace:polarLUV]{colorspace::polarLUV()}}".  If only one color is supplied, it is
used for missing and imputed data and a greyscale is used for available
data. If two colors are supplied, the first is used for missing and the
second for imputed data and a greyscale for available data.  If three colors
are supplied, the first is used as end color for the available data, while
the start color is taken to be transparent for RGB or white for HCL.
Missing/imputed data is visualized by the second/third color in this case.
If four colors are supplied, the first is used as start color and the second
as end color for the available data, while the third/fourth color is used
for missing/imputed data.}

\item{fixup}{a logical indicating whether the colors should be corrected to
valid RGB values (see \code{\link[colorspace:hex]{colorspace::hex()}}).}

\item{xlim, ylim}{axis limits.}

\item{main, sub}{main and sub title.}

\item{xlab, ylab}{axis labels.}

\item{axes}{a logical indicating whether axes should be drawn on the plot.}

\item{labels}{either a logical indicating whether labels should be plotted
below each column, or a character vector giving the labels.}

\item{xpd}{a logical indicating whether the rectangles should be allowed to
go outside the plot region.  If \code{NULL}, it defaults to \code{TRUE}
unless axis limits are specified.}

\item{interactive}{a logical indicating whether a variable to be used for
sorting can be selected interactively (see \sQuote{Details}).}

\item{\dots}{for \code{matrixplot} and \code{iimagMiss}, further graphical
parameters to be passed to \code{\link[graphics:plot.window]{graphics::plot.window()}},
\code{\link[graphics:title]{graphics::title()}} and \code{\link[graphics:axis]{graphics::axis()}}.  For
\code{TKRmatrixplot}, further arguments to be passed to \code{matrixplot}.}
}
\description{
Create a matrix plot, in which all cells of a data matrix are visualized by
rectangles.  Available data is coded according to a continuous color scheme,
while missing/imputed data is visualized by a clearly distinguishable color.
}
\details{
In a \emph{matrix plot}, all cells of a data matrix are visualized by
rectangles.  Available data is coded according to a continuous color scheme.
To compute the colors via interpolation, the variables are first scaled to
the interval between 0 and 1. Missing/imputed values can then be
visualized by a clearly distinguishable color. It is thereby possible to use
colors in the \emph{HCL} or \emph{RGB} color space. A simple way of
visualizing the magnitude of the available data is to apply a greyscale,
which has the advantage that missing/imputed values can easily be
distinguished by using a color such as red/orange.  Note that \code{-Inf}
and \code{Inf} are always assigned the begin and end color, respectively, of
the continuous color scheme.

Additionally, the observations can be sorted by the magnitude of a selected
variable.  If \code{interactive} is \code{TRUE}, clicking in a column
redraws the plot with observations sorted by the corresponding variable.
Clicking anywhere outside the plot region quits the interactive session.
}
\note{
This is a much more powerful extension to the function \code{imagmiss}
in the former CRAN package \code{dprep}.

\code{iimagMiss} is deprecated and may be omitted in future versions of
\code{VIM}.  Use \code{matrixplot} instead.
}
\examples{

data(sleep, package = "VIM")
## for missing values
x <- sleep[, -(8:10)]
x[,c(1,2,4,6,7)] <- log10(x[,c(1,2,4,6,7)])
matrixplot(x, sortby = "BrainWgt")

## for imputed values
x_imp <- kNN(sleep[, -(8:10)])
x_imp[,c(1,2,4,6,7)] <- log10(x_imp[,c(1,2,4,6,7)])
matrixplot(x_imp, delimiter = "_imp", sortby = "BrainWgt")

}
\references{
M. Templ, A. Alfons, P. Filzmoser (2012) Exploring incomplete
data using visualization tools.  \emph{Journal of Advances in Data Analysis
and Classification}, Online first. DOI: 10.1007/s11634-011-0102-y.
}
\seealso{
Other plotting functions: 
\code{\link{aggr}()},
\code{\link{barMiss}()},
\code{\link{histMiss}()},
\code{\link{marginmatrix}()},
\code{\link{marginplot}()},
\code{\link{mosaicMiss}()},
\code{\link{pairsVIM}()},
\code{\link{parcoordMiss}()},
\code{\link{pbox}()},
\code{\link{scattJitt}()},
\code{\link{scattMiss}()},
\code{\link{scattmatrixMiss}()},
\code{\link{spineMiss}()}
}
\author{
Andreas Alfons, Matthias Templ, modifications by Bernd Prantner
}
\concept{plotting functions}
\keyword{hplot}