% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/tinyplot.matrix.R
\name{tinyplot.matrix}
\alias{tinyplot.matrix}
\title{tinyplot Method for Plotting Matrices}
\usage{
\method{tinyplot}{matrix}(
  x,
  type = NULL,
  legend = NULL,
  facet = NULL,
  xlab = NULL,
  ylab = NULL,
  ...
)
}
\arguments{
\item{x}{an object of class \code{"matrix"}.}

\item{type}{plot type passed on to \code{tinyplot}. Defaults to \code{"p"} (points).}

\item{legend}{specification passed on to \code{tinyplot}. The default is to draw a
legend when the matrix has named columns, and to suppress it otherwise.}

\item{facet}{specification of \code{facet} passed on to \code{tinyplot}. The only
accepted non-\code{NULL} value is the \code{"by"} convenience string, which facets
the plot by matrix column.}

\item{xlab, ylab}{axis labels passed on to \code{tinyplot}. \code{ylab} defaults to the
deparsed matrix name. \code{xlab} defaults to \code{"Index"} when the matrix has no
row names; when it does, the row names already label the ticks so the
x-axis title is suppressed.}

\item{...}{further arguments passed to \code{tinyplot}.}
}
\value{
No return value, called for the side effect of producing a plot.
}
\description{
Convenience interface for visualizing
\code{\link[base]{matrix}} objects with tinyplot.
}
\details{
Internally the matrix is converted to long form and visualized as a
scatter (or other \code{type}) of each column's values against their row index.
Each column is mapped to a separate \code{by} category, so a matrix with
multiple columns produces a grouped plot. Optionally, it can also be
faceted via \code{facet = "by"}. This mirrors the base R
\code{\link[graphics]{matplot}} convention of plotting the columns of a
matrix against the row numbers. If the matrix has column names, these are
used as the group (and legend) labels. Single-column matrices are drawn as
a simple index plot with no grouping or legend.
}
\examples{
# basic use
tinyplot(VADeaths)
tinyplot(VADeaths, type = "b")
tinyplot(VADeaths, type = "b", legend = "direct", theme = "socviz")
tinyplot(VADeaths, type = "b", legend = FALSE, facet = "by", theme = "socviz")

# equivalent plot to an example in `?matplot`
sines = outer(1:20, 1:4, function(x, y) sin(x / 20 * pi * y))
tinyplot(sines, type = "o", pch = "by", lty = "by", col = rainbow(ncol(sines)))

}
\seealso{
\code{\link[graphics]{matplot}}
}
