plot.gps {oce} | R Documentation

## Plot a gps object

### Description

Plot a gps object

### Usage

    ## S4 method for signature 'gps'
    plot(x,
         xlab="", ylab="",
         asp,
         clongitude, clatitude, span,
         projection, parameters=NULL, orientation=NULL,
         expand=1,
         mgp=getOption("oceMgp"),
         mar=c(mgp[1]+1,mgp[1]+1,1,1),
         bg,
         axes=TRUE, cex.axis=par('cex.axis'),
         add=FALSE, inset=FALSE,
         geographical=0,
         debug=getOption("oceDebug"),
         ...)

### Arguments

`x` | A `gps` object, as read by `read.gps` or created by `as.gps`, or a list containing items named `longitude` and `latitude`.
`xlab` | label for x axis
`ylab` | label for y axis
`asp` | Aspect ratio for plot. The default is for `plot.gps` 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.
`span` | optional suggested span of plot, in kilometers. The suggestion is an upper limit on the scale; depending on the aspect ratio of the plotting device, the radius may be smaller than `span`. A value for `span` must be supplied, if `clongitude` and `clatitude` are supplied.
`projection` | optional map projection to use (see `mapPlot`); if not given, a cartesian frame is used, scaled so that gps shapes near the centre of the plot are preserved. If a projection is provided, the coordinate system will bear an indirect relationship to longitude and longitude, and further adornment of the plot must be done with e.g. `mapPoints` instead of `points`.
`parameters` | optional parameters to map projection (see `mapPlot`.
`orientation` | optional orientation of map projection (see `mapPlot`.
`expand` | numerical factor for the expansion of plot limits, showing area outside the plot, e.g. if showing a ship track as a gps, and then an actual gps 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”).
`axes` | boolean, set to `TRUE` to plot axes.
`cex.axis` | value for axis font size factor.
`add` | boolean, set to `TRUE` to draw the gps 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.
`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 gps object. An attempt is made to use the whole 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.gps` with a value of `mar` that moves the inset plot to a desired location on the existing plot, and with `bg="white"`.

### Value

None.

### Author(s)

Dan Kelley

### See Also

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

### Examples

    ## Not run:
    library(oce)
    gps <- read.oce("~/Dropbox/dalwhoi.gpx")
    plot(gps)
    lines(coastlineWorld[["longitude"]], coastlineWorld[["latitude"]])

    ## End(Not run)

[Package oce version 0.9-18 Index]