Draws density contour lines ("isopycnals") as a ggplot2 layer. The x axis is assumed to be salinity; the y axis is assumed to be temperature. To use this geometry as standalone layer, you will need to specify which type of temperature (i.e., in-situ or conservative) and salinity (i.e., practical or absolute) are on these axes.

geom_isopycnal(
  mapping = NULL,
  data = NULL,
  ...,
  lineend = "butt",
  linejoin = "round",
  linemitre = 10,
  colour = "darkgray",
  size = 0.4,
  linetype = 1,
  alpha = NA,
  text.size = 3,
  family = "",
  salinity_type = c("practical", "absolute"),
  temperature_type = c("in-situ", "potential", "conservative"),
  ref_pressure = 0,
  ref_longitude = NULL,
  ref_latitude = NULL,
  trim_freezing = TRUE,
  breaks = pretty,
  labels = identity,
  label_placer = label_placer_isopycnal(),
  n_breaks = 5,
  n_sal = 200,
  n_temp = 200,
  eos = getOption("oceEOS", default = "gsw"),
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = TRUE
)

GeomIsopycnal

Arguments

mapping

Set of aesthetic mappings created by aes() or aes_(). If specified and inherit.aes = TRUE (the default), it is combined with the default mapping at the top level of the plot. You must supply mapping if there is no plot mapping.

data

The data to be displayed in this layer. There are three options:

If NULL, the default, the data is inherited from the plot data as specified in the call to ggplot().

A data.frame, or other object, will override the plot data. All objects will be fortified to produce a data frame. See fortify() for which variables will be created.

A function will be called with a single argument, the plot data. The return value must be a data.frame, and will be used as the layer data. A function can be created from a formula (e.g. ~ head(.x, 10)).

...

Other arguments passed on to layer(). These are often aesthetics, used to set an aesthetic to a fixed value, like colour = "red" or size = 3. They may also be parameters to the paired geom/stat.

lineend, linejoin, linemitre, colour, size, linetype, alpha

Customize the appearance of contour lines. See ggplot2::geom_path() for details.

text.size, family

Customize the appearance of contour line labels. See ggplot2::geom_text() for details.

salinity_type

A salinity value. Use salinity_type = "absolute" to specify that salinity values are absolute salinities.

temperature_type

A temperature value. Use temperature_type = "conservative" to specify that these values are not in-situ temperature.

ref_pressure

The pressure that should be used to calculate density contours in dbar.

ref_longitude

The latitude and longitude that should be used in seawater calculations if eos is "gsw".

ref_latitude

The latitude and longitude that should be used in seawater calculations if eos is "gsw".

trim_freezing

Don't draw contours outside the freezing region.

breaks

A numeric vector or function used to generate breaks from objects.

labels

A function or vector of labels with which isopycnals should be labeled.

label_placer

See label_placer_isopycnal() and isoband::label_placer_minmax() for ways to customize label placement. Use NULL for a default that avoids data passed to the layer.

n_breaks

Passed to breaks if breaks is a function.

n_sal

Number of points with which contours should be approximated on the salinity axis.

n_temp

Number of points with which contours should be approximated on the temperature axis.

eos

The equation of state: one of "unesco" or "gsw". See oce::swRho() for details.

na.rm

If FALSE, the default, missing values are removed with a warning. If TRUE, missing values are silently removed.

show.legend

logical. Should this layer be included in the legends? NA, the default, includes if any aesthetics are mapped. FALSE never includes, and TRUE always includes. It can also be a named logical vector to finely select the aesthetics to display.

inherit.aes

If FALSE, overrides the default aesthetics, rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification, e.g. borders().

Format

An object of class GeomIsopycnal (inherits from Geom, ggproto, gg) of length 5.

Value

A ggplot2::layer()

Examples

library(ggplot2) data(ctd, package = "oce") ggplot(ctd, aes(salinity, temperature)) + geom_isopycnal() + geom_point()