plot.coastline {oce} | R Documentation

## Plot a coastline

### Description

Plot a coastline

### Usage

    ## S4 method for signature 'coastline'
    plot(x,
         xlab="", ylab="", showHemi=TRUE,
         asp,
         clongitude, clatitude, span,
         lonlabel=NULL, latlabel=NULL, sides=NULL,
         projection=NULL,
         expand=1,
         mgp=getOption("oceMgp"),
         mar=c(mgp[1]+1,mgp[1]+1,1,1),
         bg,
         fill, # just so we catch it's use ... will be removed at some later time
         border=NULL, col="lightgray",
         axes=TRUE, cex.axis=par('cex.axis'),
         add=FALSE, inset=FALSE,
         geographical=0,
         longitudelim, latitudelim,
         debug=getOption("oceDebug"),
         ...)

### Arguments

`x` | A `coastline` object, as read by `read.coastline` or created by `as.coastline`, or a list containing items named `longitude` and `latitude`.
`xlab` | label for x axis
`ylab` | label for y axis
`showHemi` | logical indicating whether to show the hemisphere in axis tick labels.
`asp` | Aspect ratio for plot. The default is for `plot.coastline` 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 `asp` yourself, e.g. to get correct shapes at 45N, use `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 `asp=1` or set `ylim` to be symmetric about zero. Any given value of `asp` is ignored, if `clongitude` and `clatitude` are given.
`clongitude,clatitude` | optional center latitude of map, in decimal degrees. If both `clongitude` and `clatitude` are provided, then any provided value of `asp` is ignored, and instead the plot aspect ratio is computed based on the center latitude. If `clongitude` and `clatitude` are provided, then `span` must also be provided, and in this case, it is not permitted to also specify `longitudelim` and `latitudelim`.
`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 `span` must be supplied, if `clongitude` and `clatitude` are supplied.
`lonlabel,latlabel,sides` | optional vectors of longitude and latitude to label on the indicated sides of plot, passed to `plot.coastline`. Using these arguments permits reasonably simple customization. If they are are not provided, reasonable defaults will be used.
`projection` | optional map projection to use (see `mapPlot`). If set to `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 `projection` is not set, a Mercator projection is used for latitudes below about 70 degrees, as if `projection="+proj=merc"` had been supplied, or a Stereopoloar one is used as if `projection="+proj=stere"`. Otherwise, `projection` must be a character string identifying a projection accepted by `mapPlot`.
`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 `expand` is ignored if either `xlim` or `ylim` is given.
`mgp` | 3-element numerical vector to use for `par(mgp)`, and also for `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.
`mar` | value to be used with `par("mar")`.
`bg` | optional colour to be used for the background of the map. This comes in handy for drawing insets (see “details”).
`fill` | a legacy parameter that will be permitted only temporarily; see “History”.
`border` | colour of coastlines and international borders (passed to `polygon`, which does the drawing).
`col` | the colour with which to fill (passed to `polygon`, which does the drawing.) This is ignored unless the coastline object is fillable.
`axes` | boolean, set to `TRUE` to plot axes.
`cex.axis` | value for axis font size factor.
`add` | boolean, set to `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 `asp=1/cos(lat * pi / 180)`, where `clat` is the central latitude of the plot.
`inset` | set to `TRUE` for use within `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 `plotInset`.
`geographical` | flag indicating the style of axes. If `geographical=0`, the axes are conventional, with decimal degrees as the unit, and negative signs indicating the southern and western hemispheres. If `geographical=1`, the signs are dropped, with axis values being in decreasing order within the southern and western hemispheres. If `geographical=2`, the signs are dropped and the axes are labelled with degrees, minutes and seconds, as appropriate.
`longitudelim` | this and `latitudelim` provide a second way to suggest plot ranges. Note that these may not be supplied if `clongitude`, `clatitude` and `span` are given.
`latitudelim` | see `longitudelim`.
`debug` | set to `TRUE` to get debugging information during processing.
`...` | optional arguments passed to plotting functions. For example, set `yaxp=c(-90,90,4)` for a plot extending from pole to pole.

### Details

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.

To get an inset map inside another map, draw the first map, do `par(new=TRUE)`, and then call `plot.coastline` with a value of `mar` that moves the inset plot to a desired location on the existing plot, and with `bg="white"`.

### Value

None.

### History

Until February, 2016, `plot.coastline` relied on a now-defunct argument `fill` to control colours; `col` is to be used now, instead. Also, in February, 2016, the arguments named `parameters` and `orientation` were both removed, as they had become nonfunctional about a year previously, in the transition to using rgdal to carry out map projections.

### Author(s)

Dan Kelley

### See Also

The documentation for `coastline-class` explains the structure of coastline objects, and also outlines the other functions dealing with them.

### Examples

    ## Not run:
    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')

    ## End(Not run)

[Package oce version 0.9-18 Index]