\HeaderA{image-methods}{Methods for image() in Package 'Matrix'}{image.Rdash.methods}
\aliasA{image,ANY-method}{image-methods}{image,ANY.Rdash.method}
\aliasA{image,CHMfactor-method}{image-methods}{image,CHMfactor.Rdash.method}
\aliasA{image,dgCMatrix-method}{image-methods}{image,dgCMatrix.Rdash.method}
\aliasA{image,dgRMatrix-method}{image-methods}{image,dgRMatrix.Rdash.method}
\aliasA{image,dgTMatrix-method}{image-methods}{image,dgTMatrix.Rdash.method}
\aliasA{image,dsparseMatrix-method}{image-methods}{image,dsparseMatrix.Rdash.method}
\aliasA{image,lsparseMatrix-method}{image-methods}{image,lsparseMatrix.Rdash.method}
\aliasA{image,Matrix-method}{image-methods}{image,Matrix.Rdash.method}
\aliasA{image,nsparseMatrix-method}{image-methods}{image,nsparseMatrix.Rdash.method}
\keyword{methods}{image-methods}
\keyword{hplot}{image-methods}
\begin{Description}\relax
Methods for function \code{\LinkA{image}{image}} in package
\pkg{Matrix}.  An image of a matrix simply color codes all matrix
entries and draws the \eqn{n\times m}{} matrix using an
\eqn{n\times m}{} grid of (colored) rectangles.
\end{Description}
\begin{Usage}
\begin{verbatim}
## S4 method for signature 'dgTMatrix':
image(x,
      xlim = .5 + c(0, di[2]),
      ylim = .5 + c(di[1], 0), aspect = "iso",
      sub = sprintf("Dimensions: %d x %d", di[1], di[2]),
      xlab = "Column", ylab = "Row",
      useAbs = NULL, colorkey = !useAbs,
      col.regions = NULL,
      lwd = NULL, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] a Matrix object, i.e., fulfilling
\code{\LinkA{is}{is}(x, "Matrix")}.
\item[\code{xlim, ylim}] x- and y-axis limits; may be used to \dQuote{zoom
into} matrix.
\item[\code{aspect}] aspect ratio specified as number (y/x) or string;
see \code{\LinkA{levelplot}{levelplot}}.
\item[\code{sub, xlab, ylab}] axis annotation with sensible defaults;
see \code{\LinkA{plot.default}{plot.default}}.
\item[\code{useAbs}] logical indicating if \code{\LinkA{abs}{abs}(x)} should be
shown; if \code{TRUE}, the former (implicit) default, the default
\code{col.regions} will be \code{\LinkA{grey}{grey}} colors (and no
\code{colorkey} drawn).  The default is \code{FALSE} unless the
matrix has no negative entries.
\item[\code{colorkey}] logical indicating if a color key aka \sQuote{legend}
should be produced.  Default is to draw one, unless \code{useAbs} is
true.
\item[\code{col.regions}] vector of gradually varying colors; see
\code{\LinkA{levelplot}{levelplot}}.
\item[\code{lwd}] non-negative number or \code{NULL} (default), specifying the
line-width of the rectangles of each non-zero matrix entry (drawn by
\code{\LinkA{grid.rect}{grid.rect}}).  The default depends on the matrix
dimension and the device size.
\item[\code{...}] further arguments passed to methods and
\code{\LinkA{levelplot}{levelplot}}.
\end{ldescription}
\end{Arguments}
\begin{Section}{Methods}
All methods currently end up calling the method for the
\code{\LinkA{dgTMatrix}{dgTMatrix.Rdash.class}} class.
Use \code{showMethods(image)} to list them all.
\end{Section}
\begin{Examples}
\begin{ExampleCode}
showMethods(image)
## If you want to see all the methods' implementations:
showMethods(image, incl=TRUE, inherit=FALSE)

data(CAex)
image(CAex, main = "image(CAex)")
image(CAex, useAbs=TRUE, main = "image(CAex, useAbs=TRUE)")

cCA <- Cholesky(crossprod(CAex), Imult = .01)
image(cCA, main="Cholesky(crossprod(CAex), Imult = .01)")
image(cCA, useAbs=TRUE)

data(USCounties)
image(USCounties)# huge
image(sign(USCounties))## just the pattern
    # how the result looks, may depend heavily on
    # the device, screen resolution, antialiasing etc
    # e.g. x11(type="Xlib") may show very differently than cairo-based

## Drawing borders around each rectangle;
    # again, viewing depends very much on the device:
image(USCounties[1:400,1:200], lwd=.1)
image(USCounties[1:200,1:200], lwd=.5)
image(USCounties[1:200,1:200], lwd=.01)
\end{ExampleCode}
\end{Examples}

