Skip to contents

Plot CTD data as time-series against scan number, to help with trimming extraneous data from a CTD cast.


  which = 1,
  xtype = "scan",
  flipy = FALSE,
  type = "l",
  mgp = getOption("oceMgp"),
  xlim = NULL,
  ylim = NULL,
  mar = c(mgp[1] + 1.5, mgp[1] + 1.5, mgp[1], mgp[1]),
  debug = getOption("oceDebug")



a ctd object.


integer specifying the plot to be drawn: 1 for pressure vs 'x', 2 for diff(pressure) vs 'x', 3 for temperature vs 'x', and 4 for salinity vs 'x' Here, the value of 'x' is determined by xtype.


Character string indicating variable for the x axis. The permitted values are "scan" (the default), "time" and "index". The last of these is created by using seq_along() on the pressure column (which is assumed to be present in any ctd object). Only xtype="index" is guaranteed to work for all objects, and indeed that value is used, if either "scan" or "time" is requested, but unavailable.


Logical value, ignored unless which is 1. If flipy is TRUE, then a pressure plot will have high pressures at the bottom of the axis.


Character indicating the line type, as for plot.default(). The default is "l", meaning to connect data with line segments. Another good choice is "o", to add points at the data.


Three-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.


Limits on the x value. The default, NULL, is to select this from the data.


Limits on the y value. The default, NULL, is to select this from the data.


Four-element vector be used with par("mar"). If set to NULL, then par("mar") is used. A good choice for a TS diagram with a palette to the right is mar=par("mar")+c(0, 0, 0, 1)).


Optional arguments passed to plotting functions.


an integer specifying whether debugging information is to be printed during the processing. This is a general parameter that is used by many oce functions. Generally, setting debug=0 turns off the printing, while higher values suggest that more information be printed. If one function calls another, it usually reduces the value of debug first, so that a user can often obtain deeper debugging by specifying higher debug values.

Historical Note

On 2022-12-07, xtype was expanded to include "index", and an undocumented multi-panel feature was removed.


Dan Kelley


abline(v = c(130, 350), col = "red") # useful for ctdTrim()