maps
library.
To make it available in your Spotfire S+ session,
use the command
library(maps)
.
map(database, regions) map(database="state", regions=".", xlim, ylim, boundary=T, interior=T, fill=F, color=1, projection="", parameters=NULL, orientation=c(90,0,m), resolution=1, type="l", plot=T, add=F, namesonly=F, exact=T, ...)
world
database
along with four U.S.A. databases:
usa
draws national boundaries,
state
draws state boundaries,
county
draws county boundaries,
and
state.vbm
constructs
a Visibility Base Map of the United States.
Detailed documentation can be found in the help files for
World
,
Usa
,
State
,
County
,
and
State.vbm
(i.e., the database names with initial capital letters).
regions
argument is
matched as a regular expression against all the polygon names
in the chosen database, and matches are selected for drawing.
The default selects all polygons in the database.
xlim
,
ylim
and
color
arguments can potentially modify
the list of polygons to draw.
See below for descriptions of these arguments.
fill=TRUE
,
polygons selected by
regions
must be completely inside the
xlim
range.
The default spans the entire longitude range of the chosen database.
fill=TRUE
,
polygons selected by
regions
must be completely inside the
ylim
range.
The default spans the entire latitude range of the chosen database.
fill=TRUE
.
fill=TRUE
.
fill=FALSE
,
the lines bounding each region are drawn.
If
fill=TRUE
,
each region is filled using colors from the
color
argument, and bounding lines are not drawn.
fill=FALSE
,
the first color is used for plotting all lines
and any other colors are ignored.
Otherwise, the colors are matched in order with the polygons
selected by the
regions
argument,
and are reused cyclically if necessary.
Polygon colors are assigned after polygons are deleted
(i.e., after the
xlim
and
ylim
arguments are applied).
A color of
NA
causes the corresponding region
to be deleted from the list of polygons to be drawn.
projection
argument.
This argument is not required for all projections,
as certain projections do not need additional parameters.
See Appendix C of the reference for details.
c(90,0,m)
,
where
m
is the middle of the longitude range.
See Appendix C of the reference for details.
resolution
device pixels of one another
are collapsed to a single point.
See the reference for further details.
type="n"
can be used
to set up the coordinate system and projection for a map
that will be modified in later calls.
plot=TRUE
,
the return value of
map
is not printed automatically.
add=FALSE
,
a new plot is generated on a new coordinate system.
namesonly=FALSE
, map coordinates are returned.
TRUE
then exact matching
of
regions
in the database will be done,
otherwise, partial matching will be done.
map
function;
see
for details.
database
,
through the
regions
,
xlim
,
and
ylim
arguments,
are outlined if
fill=FALSE
and filled if
fill=TRUE
.
The colors used in drawing the polygons are specified by
the
color
argument.
namesonly
argument.
When
namesonly=TRUE
,
the return value is a character vector of the names of the polygons
that were selected for drawing.
When
namesonly=FALSE
,
the return value is a list with
x
and
y
components that contain the coordinates
of the selected polygons.
If
fill=FALSE
,
the return vectors are the coordinates of successive polygon lines,
separated by
NA
s.
If
fill=TRUE
,
the vectors are coordinates of successive polygons,
again separated by
NA
s.
Thus, the return value can be passed directly to
lines
or
polygon
, as appropriate.
map
in which
the
projection
argument is specified,
a data set called
.Last.projection
is created
on frame 0.
This data set contains information about the projection
and is used in subsequent calls to
map
.
For further details, see the documentation
for
mapproject
.
Becker, R. A. and Wilks, A. R. (1991). Maps in S. AT&T Bell Laboratories Statistics Research Report.
# load the maps library library(maps) # state map of the USA map() # national boundaries map("usa") # county map of New Jersey map("county", "new jersey") # map of three states map(regions=c("new york","new jersey","penn")) # Bonne equal-area projection of the USA map(proj="bonne", param=45) # names of the San Juan islands in Washington state map("county", "washington,san", names=T, plot=F) # plot the ozone data on a base map map(xlim=range(ozone.xy$x), ylim=range(ozone.xy$y)) text(ozone.xy, labels=ozone.median) # national boundaries in one color, states in another map(interior=F) map(boundary=F, lty=2, add=T)