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
|
\name{SparseM.image}
\title{Image Plot for Sparse Matrices}
\alias{image}
\alias{SparseM.image}
\alias{image,matrix.csr-method}
\description{Display the pattern of non-zero entries of
a matrix of class \code{matrix.csr}.% or \code{matrix.csc}
}
\usage{
\S4method{image}{matrix.csr}(x, col=c("white","gray"),
xlab="column", ylab="row", \dots)
}
\arguments{
\item{x}{a matrix of class \code{matrix.csr}.}% or \code{matrix.csc}.}
\item{col}{a list of colors such as that generated by \code{\link{rainbow}}.
Defaults to c("white","gray")}
\item{xlab,ylab}{each a character string giving the labels for the x and y axis.}
\item{\dots}{additional arguments.}
}
\details{The pattern of the non-zero entries of a sparse matrix
is displayed. By default nonzero entries of the matrix appear
as gray blocks and zero entries as white background.}
\references{
Koenker, R and Ng, P. (2002).
SparseM: A Sparse Matrix Package for \R,\cr
\url{http://www.econ.uiuc.edu/~roger/research/home.html}
}
\seealso{
\code{SparseM.ops},
\code{SparseM.solve},
\code{SparseM.ontology}
}
\examples{
a <- rnorm(20*5)
A <- matrix(a,20,5)
A[row(A)>col(A)+4|row(A)<col(A)+3] <- 0
b <- rnorm(20*5)
B <- matrix(b,20,5)
B[row(A)>col(A)+2|row(A)<col(A)+2] <- 0
image(as.matrix.csr(A)\%*\%as.matrix.csr(t(B)))
}
\keyword{hplot}
\keyword{algebra}
|