Skip to content


Subversion checkout URL

You can clone with
Download ZIP
tree: c185e2f264
Fetching contributors…

Cannot retrieve contributors at this time

62 lines (54 sloc) 2.073 kB
\title{Create data for drawing maps}
map_qdata(database, regions = ".", color = "gray50",
border = "gray90", size = 4, cartogram = FALSE,
diffuse = 5, label = NULL, ...)
\item{database}{see \code{\link[maps]{map}}}
\item{regions}{see \code{\link[maps]{map}}}
\item{cartogram}{whether to transform the map data in
order to create a cartogram; if \code{TRUE}, the shape of
the cartogram will be determined by the \code{size}
parameter in the data (i.e. \code{data$.size}); see
\code{\link{cart_polygon}} for details}
\item{...}{passed to \code{\link{cart_polygon}}}
\item{color}{colors of graphical elements (default dark
gray) corresponding to rows of data; it can be a vector
of valid R colors, or a name of variable in \code{data}
(must be either a factor or a numeric variable), or an R
expression to calculate colors; \code{color} is used to
fill the interior of graphical elements}
\item{border}{colors for the border of graphical elements
(e.g. rectangles); \code{NA} means to suppress the
\item{size}{sizes of rows; possible values are similar to
\code{color}, but when using a variable to generate
sizes, it must be a numeric variable}
A mutaframe of region names and labels, with an attribute
\code{MapData} containing the coordinates of polygons.
This function converts maps data in the \pkg{maps}
package to a suitable format for \pkg{cranvas}.
Optionally it transforms the data to make cartograms.
The function \code{\link[maps]{map}} is used to convert
maps data to a list, then the region names are stored in
a mutaframe created by \code{\link{qdata}}; the polygon
coordinates are stored in an attribute \code{MapData}. If
multiple polygons belong to the same upper-level region,
the column \code{labels} will store the upper-level
region names.
library(cranvas); map_qdata('state'); map_qdata('county', 'iowa')
Yihui Xie <\url{}>
Jump to Line
Something went wrong with that request. Please try again.