% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/coastline.R
\name{plot,coastline-method}
\alias{plot,coastline-method}
\alias{plot.coastline}
\title{Plot a coastline Object}
\usage{
\S4method{plot}{coastline}(
  x,
  xlab = "",
  ylab = "",
  showHemi = TRUE,
  asp,
  clongitude,
  clatitude,
  span,
  lonlabels = TRUE,
  latlabels = TRUE,
  projection = NULL,
  expand = 1,
  mgp = getOption("oceMgp"),
  mar = c(mgp[1] + 1, mgp[1] + 1, 1, 1),
  bg,
  fill,
  type = "polygon",
  border = NULL,
  col = NULL,
  axes = TRUE,
  cex.axis = par("cex.axis"),
  add = FALSE,
  inset = FALSE,
  geographical = 0,
  longitudelim,
  latitudelim,
  debug = getOption("oceDebug"),
  ...
)
}
\arguments{
\item{x}{a \linkS4class{coastline} object.}

\item{xlab}{label for x axis}

\item{ylab}{label for y axis}

\item{showHemi}{logical indicating whether to show the hemisphere in axis
tick labels.}

\item{asp}{Aspect ratio for plot.  The default is for \verb{plot,coastline-method}
to set the aspect ratio to give natural latitude-longitude scaling somewhere
near the centre latitude on the plot. Often, it makes sense to set
\code{asp} yourself, e.g. to get correct shapes at 45N, use
\code{asp=1/cos(45*pi/180)}.  Note that the land mass is not symmetric about
the equator, so to get good world views you should set \code{asp=1} or set
\code{ylim} to be symmetric about zero. Any given value of \code{asp} is
ignored, if \code{clongitude} and \code{clatitude} are given (or
if the latter two are inferred from \code{projection}.}

\item{clongitude, clatitude}{optional center latitude of map, in decimal
degrees.  If both \code{clongitude} and \code{clatitude} are provided,
or alternatively if they can be inferred from substrings \code{+lon_0}
and \code{+lat_0} in \code{projection}, then
any provided value of \code{asp} is ignored, and instead the plot aspect
ratio is computed based on the center latitude.  If \code{clongitude} and
\code{clatitude} are known, then \code{span} must also be provided, and
in this case, it is not permitted to also specify \code{longitudelim} and
\code{latitudelim}.}

\item{span}{optional suggested diagonal span of the plot, in kilometers.
The plotted span is usually close to the suggestion, although the details
depend on the plot aspect ratio and other factors, so some adjustment may be
required to fine-tune a plot.  A value for \code{span} must be supplied, if
\code{clongitude} and \code{clatitude} are supplied
(or inferred from \code{projection}).}

\item{lonlabels, latlabels}{optional vectors of longitude and latitude to
label on the sides of plot, passed to \code{\link[=mapPlot]{mapPlot()}} to control
axis labelling, for plots done with map projections (i.e. for
cases in which \code{projection} is not \code{NULL}).}

\item{projection}{optional map projection to use (see
the \code{\link[=mapPlot]{mapPlot()}} argument of the same name).
If set to \code{FALSE} then no projection is used,
and the data are plotted in a cartesion frame, with aspect ratio set to
reduce distortion near the middle of the plot.  This option is useful if the
coastline produces spurious horizontal lines owing to islands crossing the
plot edges (a problem that plagues map projections).  If \code{projection}
is not set, a Mercator projection is used for latitudes below about 70
degrees, as if \code{projection="+proj=merc"} had been supplied, or a
Stereopolar one is used as if \code{projection="+proj=stere"}.  Otherwise,
\code{projection} must be a character string identifying a projection
accepted by \code{\link[=mapPlot]{mapPlot()}}.}

\item{expand}{numerical factor for the expansion of plot limits, showing
area outside the plot, e.g. if showing a ship track as a coastline, and then
an actual coastline to show the ocean boundary.  The value of \code{expand}
is ignored if either \code{xlim} or \code{ylim} is given.}

\item{mgp}{3-element numerical vector to use for \code{\link{par}}\code{("mgp")}, and also
for \code{par(mar)}, computed from this.  The default is tighter than the R
default, in order to use more space for the data and less for the axes.}

\item{mar}{value to be used with \code{\link{par}}\code{("mar")}.}

\item{bg}{optional color to be used for the background of the map.  This
comes in handy for drawing insets (see \dQuote{details}).}

\item{fill}{a legacy parameter that will be permitted only temporarily; see
\dQuote{History}.}

\item{type}{indication of type; may be \code{"polygon"}, for a filled polygon,
\code{"p"} for points, \code{"l"} for line segments, or \code{"o"} for points
overlain with line segments. See \code{color} for a note on how
the the value of \code{type} alters the meaning of the \code{color}
argument.}

\item{border}{color used to indicate land (if \code{type="polygon"}) or
the coastline and international borders (if \code{type="l"}).}

\item{col}{either the color for filling polygons (if \code{type="polygon"})
or the color of the points and line segments (if \code{type="p"},
\code{type="l"}, or \code{type="o"}).}

\item{axes}{boolean, set to \code{TRUE} to plot axes.}

\item{cex.axis}{value for axis font size factor.}

\item{add}{boolean, set to \code{TRUE} to draw the coastline on an existing
plot.  Note that this retains the aspect ratio of that existing plot, so it
is important to set that correctly, e.g. with \code{asp=1/cos(lat * pi /
180)}, where \code{clat} is the central latitude of the plot.}

\item{inset}{set to \code{TRUE} for use within \code{\link[=plotInset]{plotInset()}}.  The
effect is to prevent the present function from adjusting margins, which is
necessary because margin adjustment is the basis for the method used by
\code{\link[=plotInset]{plotInset()}}.}

\item{geographical}{flag indicating the style of axes.  With
\code{geographical=0}, the axes are conventional, with decimal degrees as
the unit, and negative signs indicating the southern and western
hemispheres.  With \code{geographical=1}, the signs are dropped, with axis
values being in decreasing order within the southern and western
hemispheres.  With \code{geographical=2}, the signs are dropped and the axes
are labelled with degrees, minutes and seconds, as appropriate, and
hemispheres are indicated with letters. With \code{geographical=3}, things
are the same as for \code{geographical=2}, but the hemisphere indication
is omitted. Finally, with \code{geographical=4}, unsigned numbers are used,
followed by letters \code{N} in the northern hemisphere, \code{S} in the southern,
\code{E} in the eastern, and \code{W} in the western.}

\item{longitudelim}{this and \code{latitudelim} provide a second way to
suggest plot ranges. Note that these may not be supplied if
\code{clongitude}, \code{clatitude} and \code{span} are given.}

\item{latitudelim}{see \code{longitudelim}.}

\item{debug}{set to \code{TRUE} to get debugging information during
processing.}

\item{\dots}{optional arguments passed to plotting functions.  For example,
set \code{yaxp=c(-90,90,4)} for a plot extending from pole to pole.}
}
\value{
None.
}
\description{
This function plots a coastline.  An attempt is made to fill the space of
the plot, and this is done by limiting either the longitude range or the
latitude range, as appropriate, by modifying the eastern or northern limit,
as appropriate.
}
\details{
If \code{longitudelim}, \code{latitudelim} and \code{projection} are all given,
then these arguments are passed to \code{\link[=mapPlot]{mapPlot()}} to produce the plot.
(The call uses \code{bg} for \code{col}, and uses \code{col}, \code{fill}
and \code{border} directly.) If the results need further customization,
users should use \code{\link[=mapPlot]{mapPlot()}} directly.

If \code{projection} is provided without \code{longitudelim} or \code{latitudelim},
then \code{\link[=mapPlot]{mapPlot()}} is still called, but \code{longitudelim} and
\code{latitudelim} are computed from \code{clongitude}, \code{clatitude} and \code{span}.

If \code{projection} is not provided, much simpler plots are produced. These are
Cartesian, with aspect ratio set to minimize shape distortion at the central latitude.
Although these are crude, they have the benefit of always working, which cannot
be said of true map projections, which can be problematic in various ways owing
to difficulties in inverting projection calculations.

To get an inset map inside another map, draw the first map, do
\code{\link{par}}\code{(new=TRUE)}, and then call \code{\link[=plot,coastline-method]{plot,coastline-method()}} with a value of
\code{mar} that moves the inset plot to a desired location on the existing
plot, and with \code{bg="white"}.
}
\section{History}{
 Until February, 2016, \verb{plot,coastline-method} relied on a
now-defunct argument \code{fill} to control colors; \code{col} is to be
used now, instead.
}

\examples{
\donttest{
library(oce)
par(mar = c(2, 2, 1, 1))
data(coastlineWorld)
plot(coastlineWorld)
plot(coastlineWorld, clongitude = -63.6, clatitude = 44.6, span = 1000)

# Canada in Lambert projection
plot(coastlineWorld,
    clongitude = -95, clatitude = 65, span = 5500,
    grid = 10, projection = "+proj=laea +lon_0=-100 +lat_0=55"
)
}

}
\seealso{
The documentation for the \linkS4class{coastline} class explains the
structure of coastline objects, and also outlines the other functions
dealing with them.

Other functions that plot oce data: 
\code{\link{plot,adp-method}},
\code{\link{plot,adv-method}},
\code{\link{plot,amsr-method}},
\code{\link{plot,argo-method}},
\code{\link{plot,bremen-method}},
\code{\link{plot,cm-method}},
\code{\link{plot,ctd-method}},
\code{\link{plot,gps-method}},
\code{\link{plot,ladp-method}},
\code{\link{plot,landsat-method}},
\code{\link{plot,lisst-method}},
\code{\link{plot,lobo-method}},
\code{\link{plot,met-method}},
\code{\link{plot,odf-method}},
\code{\link{plot,rsk-method}},
\code{\link{plot,satellite-method}},
\code{\link{plot,sealevel-method}},
\code{\link{plot,section-method}},
\code{\link{plot,tidem-method}},
\code{\link{plot,topo-method}},
\code{\link{plot,windrose-method}},
\code{\link{plot,xbt-method}},
\code{\link{plotProfile}()},
\code{\link{plotScan}()},
\code{\link{plotTS}()}

Other things related to coastline data: 
\code{\link{[[,coastline-method}},
\code{\link{[[<-,coastline-method}},
\code{\link{as.coastline}()},
\code{\link{coastline-class}},
\code{\link{coastlineBest}()},
\code{\link{coastlineCut}()},
\code{\link{coastlineWorld}},
\code{\link{download.coastline}()},
\code{\link{read.coastline.openstreetmap}()},
\code{\link{read.coastline.shapefile}()},
\code{\link{subset,coastline-method}},
\code{\link{summary,coastline-method}}
}
\author{
Dan Kelley
}
\concept{functions that plot oce data}
\concept{things related to coastline data}
