<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><title>Add Isopycnal Curves to a TS Plot — drawIsopycnals • oce</title><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/font-awesome-6.4.2/css/all.min.css" rel="stylesheet"><link href="../deps/font-awesome-6.4.2/css/v4-shims.min.css" rel="stylesheet"><script src="../deps/headroom-0.11.0/headroom.min.js"></script><script src="../deps/headroom-0.11.0/jQuery.headroom.min.js"></script><script src="../deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js"></script><script src="../deps/clipboard.js-2.0.11/clipboard.min.js"></script><script src="../deps/search-1.0.0/autocomplete.jquery.min.js"></script><script src="../deps/search-1.0.0/fuse.min.js"></script><script src="../deps/search-1.0.0/mark.min.js"></script><!-- pkgdown --><script src="../pkgdown.js"></script><meta property="og:title" content="Add Isopycnal Curves to a TS Plot — drawIsopycnals"><meta name="description" content="Adds isopycnal lines to an existing temperature-salinity plot.  This is
called by plotTS(), and may be called by the user also, e.g. if
an image plot is used to show TS data density."><meta property="og:description" content="Adds isopycnal lines to an existing temperature-salinity plot.  This is
called by plotTS(), and may be called by the user also, e.g. if
an image plot is used to show TS data density."></head><body>
    <a href="#main" class="visually-hidden-focusable">Skip to contents</a>


    <nav class="navbar navbar-expand-lg fixed-top bg-light" data-bs-theme="light" aria-label="Site navigation"><div class="container">

    <a class="navbar-brand me-2" href="../index.html">oce</a>

    <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">1.8-4</small>


    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>

    <div id="navbar" class="collapse navbar-collapse ms-3">
      <ul class="navbar-nav me-auto"><li class="active nav-item"><a class="nav-link" href="../reference/index.html">Reference</a></li>
<li class="nav-item dropdown">
  <button class="nav-link dropdown-toggle" type="button" id="dropdown-articles" data-bs-toggle="dropdown" aria-expanded="false" aria-haspopup="true">Articles</button>
  <ul class="dropdown-menu" aria-labelledby="dropdown-articles"><li><a class="dropdown-item" href="../articles/A_oce.html">1. Introduction to Oce</a></li>
    <li><a class="dropdown-item" href="../articles/B_ctd.html">2. Analysis of CTD data</a></li>
    <li><a class="dropdown-item" href="../articles/C_adp.html">3. Analysis of acoustic-Doppler data</a></li>
    <li><a class="dropdown-item" href="../articles/D_map_projections.html">4. Using map projections</a></li>
    <li><a class="dropdown-item" href="../articles/E_flags.html">5. Dealing with data-quality flags</a></li>
    <li><a class="dropdown-item" href="../articles/F_subclassing.html">6. Subclassing oce objects</a></li>
    <li><a class="dropdown-item" href="../articles/G_altering_defaults.html">7. Altering oce Defaults</a></li>
    <li><a class="dropdown-item" href="../articles/H_tides.html">8. Tidal Analysis</a></li>
  </ul></li>
<li class="nav-item"><a class="nav-link" href="../news/index.html">Changelog</a></li>
      </ul><ul class="navbar-nav"><li class="nav-item"><form class="form-inline" role="search">
 <input class="form-control" type="search" name="search-input" id="search-input" autocomplete="off" aria-label="Search site" placeholder="Search for" data-search-index="../search.json"></form></li>
<li class="nav-item"><a class="external-link nav-link" href="https://github.com/dankelley/oce/" aria-label="GitHub"><span class="fa fab fa-github fa-lg"></span></a></li>
      </ul></div>


  </div>
</nav><div class="container template-reference-topic">
<div class="row">
  <main id="main" class="col-md-9"><div class="page-header">

      <h1>Add Isopycnal Curves to a TS Plot</h1>
      <small class="dont-index">Source: <a href="https://github.com/dankelley/oce/blob/HEAD/R/ctd.R" class="external-link"><code>R/ctd.R</code></a></small>
      <div class="d-none name"><code>drawIsopycnals.Rd</code></div>
    </div>

    <div class="ref-description section level2">
    <p>Adds isopycnal lines to an existing temperature-salinity plot.  This is
called by <code><a href="plotTS.html">plotTS()</a></code>, and may be called by the user also, e.g. if
an image plot is used to show TS data density.</p>
    </div>

    <div class="section level2">
    <h2 id="ref-usage">Usage<a class="anchor" aria-label="anchor" href="#ref-usage"></a></h2>
    <div class="sourceCode"><pre class="sourceCode r"><code><span><span class="fu">drawIsopycnals</span><span class="op">(</span></span>
<span>  nlevels <span class="op">=</span> <span class="fl">6</span>,</span>
<span>  <span class="va">levels</span>,</span>
<span>  rotate <span class="op">=</span> <span class="cn">TRUE</span>,</span>
<span>  rho1000 <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span>  digits <span class="op">=</span> <span class="fl">2</span>,</span>
<span>  eos <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/options.html" class="external-link">getOption</a></span><span class="op">(</span><span class="st">"oceEOS"</span>, default <span class="op">=</span> <span class="st">"gsw"</span><span class="op">)</span>,</span>
<span>  longitude <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span>  latitude <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span>  trimIsopycnals <span class="op">=</span> <span class="cn">TRUE</span>,</span>
<span>  gridIsopycnals <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="fl">50</span>, <span class="fl">50</span><span class="op">)</span>,</span>
<span>  cex <span class="op">=</span> <span class="fl">0.75</span> <span class="op">*</span> <span class="fu"><a href="https://rdrr.io/r/graphics/par.html" class="external-link">par</a></span><span class="op">(</span><span class="st">"cex"</span><span class="op">)</span>,</span>
<span>  col <span class="op">=</span> <span class="st">"darkgray"</span>,</span>
<span>  lwd <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/graphics/par.html" class="external-link">par</a></span><span class="op">(</span><span class="st">"lwd"</span><span class="op">)</span>,</span>
<span>  lty <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/graphics/par.html" class="external-link">par</a></span><span class="op">(</span><span class="st">"lty"</span><span class="op">)</span>,</span>
<span>  debug <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/options.html" class="external-link">getOption</a></span><span class="op">(</span><span class="st">"oceDebug"</span><span class="op">)</span></span>
<span><span class="op">)</span></span></code></pre></div>
    </div>

    <div class="section level2">
    <h2 id="arguments">Arguments<a class="anchor" aria-label="anchor" href="#arguments"></a></h2>


<dl><dt id="arg-nlevels">nlevels<a class="anchor" aria-label="anchor" href="#arg-nlevels"></a></dt>
<dd><p>suggested number of density levels (i.e. isopycnal curves);
ignored if <code>levels</code> is supplied.  If this is set to 0, no isopycnal
are drawn (see also <code>levels</code>, next).</p></dd>


<dt id="arg-levels">levels<a class="anchor" aria-label="anchor" href="#arg-levels"></a></dt>
<dd><p>optional density levels to draw.  If this is <code>NULL</code>, then
no isopycnals are drawn.</p></dd>


<dt id="arg-rotate">rotate<a class="anchor" aria-label="anchor" href="#arg-rotate"></a></dt>
<dd><p>boolean, set to <code>TRUE</code> to write all density labels
horizontally.</p></dd>


<dt id="arg-rho-">rho1000<a class="anchor" aria-label="anchor" href="#arg-rho-"></a></dt>
<dd><p>boolean, set to <code>TRUE</code> to write isopycnal labels as e.g.
1024 instead of 24.</p></dd>


<dt id="arg-digits">digits<a class="anchor" aria-label="anchor" href="#arg-digits"></a></dt>
<dd><p>minimum number of decimal digits to use in label (supplied to
<code><a href="https://rdrr.io/r/base/Round.html" class="external-link">round()</a></code>). If the density range is very small, <code>drawIsopycnals()</code>
will increase value of <code>digits</code>, to try to make labels be distinct.</p></dd>


<dt id="arg-eos">eos<a class="anchor" aria-label="anchor" href="#arg-eos"></a></dt>
<dd><p>equation of state to be used, either <code>"unesco"</code> or
<code>"gsw"</code>.  If it is <code>"gsw"</code> then <code>latitude</code> and <code>longitude</code> must
be supplied, since these are needed to computer density in that
formulation.</p></dd>


<dt id="arg-longitude-latitude">longitude, latitude<a class="anchor" aria-label="anchor" href="#arg-longitude-latitude"></a></dt>
<dd><p>numerical values giving the location
to be used in density calculations, if <code>eos</code> is <code>"gsw"</code>.</p></dd>


<dt id="arg-trimisopycnals">trimIsopycnals<a class="anchor" aria-label="anchor" href="#arg-trimisopycnals"></a></dt>
<dd><p>logical value (<code>TRUE</code> by default) that
indicates whether to trim isopycnal curves (if drawn)
to the region of temperature-salinity space for which density
computations are considered to be valid in the context of the
chosen <code>eos</code>; see the “Details” of the documentation
for <code><a href="plotTS.html">plotTS()</a></code>.</p></dd>


<dt id="arg-gridisopycnals">gridIsopycnals<a class="anchor" aria-label="anchor" href="#arg-gridisopycnals"></a></dt>
<dd><p>a parameter that controls how the isopycnals
are computed.  This may be NULL, or an integer vector of length 2.
<em>Case 1:</em> if <code>gridIsopycnals</code> is NULL, then
the isopycnals are drawn by tracing density
isopleths in salinity-temperature space. This method was
used as the default prior to version 1.7-11, but it was
found to yield staircase-like isopycnal curves for highly
zoomed-in plots (e.g. with millidegree temperature ranges).
<em>Case 2 (the new default):</em> If <code>gridIsopycnals</code> is a two-element integer
vector, then a grid of density is constructed, with <code>gridIsopycnals[1]</code>
salinity levels and <code>gridIsopycnals[2]</code> temperature levels, and
then <code><a href="https://rdrr.io/r/grDevices/contourLines.html" class="external-link">contourLines()</a></code> is used to trace the isopycnals. The default
value of <code>gridIsopycnals</code> yields a grid of millimeter-scale spacing
for a typical plot.</p></dd>


<dt id="arg-cex">cex<a class="anchor" aria-label="anchor" href="#arg-cex"></a></dt>
<dd><p>size for labels.</p></dd>


<dt id="arg-col">col<a class="anchor" aria-label="anchor" href="#arg-col"></a></dt>
<dd><p>color for lines and labels.</p></dd>


<dt id="arg-lwd">lwd<a class="anchor" aria-label="anchor" href="#arg-lwd"></a></dt>
<dd><p>line width for isopycnal curves</p></dd>


<dt id="arg-lty">lty<a class="anchor" aria-label="anchor" href="#arg-lty"></a></dt>
<dd><p>line type for isopycnal curves</p></dd>


<dt id="arg-debug">debug<a class="anchor" aria-label="anchor" href="#arg-debug"></a></dt>
<dd><p>an integer specifying whether debugging information is
to be printed during the processing. This is a general parameter that
is used by many <code>oce</code> functions. Generally, setting <code>debug=0</code>
turns off the printing, while higher values suggest that more information
be printed. If one function calls another, it usually reduces the value of
<code>debug</code> first, so that a user can often obtain deeper debugging
by specifying higher <code>debug</code> values.</p></dd>

</dl></div>
    <div class="section level2">
    <h2 id="value">Value<a class="anchor" aria-label="anchor" href="#value"></a></h2>
    <p>None.</p>
    </div>
    <div class="section level2">
    <h2 id="details">Details<a class="anchor" aria-label="anchor" href="#details"></a></h2>
    <p>The default method of drawing isopycnals was changed in February of 2023,
so that even plots that are zoomed in to have millidegree temperature ranges
will have smooth curves.  See the discussion of <code>gridIsopycnals</code> for
details.</p>
    </div>
    <div class="section level2">
    <h2 id="references">References<a class="anchor" aria-label="anchor" href="#references"></a></h2>

<ul><li><p>Fofonoff, N. P., and R. C. Millard.
"Algorithms for Computation of Fundamental Properties of Seawater."
UNESCO Technical Papers in Marine Research. SCOR working group on Evaluation of CTD data;
UNESCO/ICES/SCOR/IAPSO Joint Panel on Oceanographic Tables and Standards, 1983.
<code>https://unesdoc.unesco.org/ark:/48223/pf0000059832</code>.</p></li>
<li><p>McDougall, Trevor J., David R. Jackett, Daniel G. Wright, and Rainer Feistel.
"Accurate and Computationally Efficient Algorithms for Potential Temperature and Density of Seawater."
Journal of Atmospheric and Oceanic Technology 20, no. 5 (May 1, 2003): 730-41.
<code>https://journals.ametsoc.org/jtech/article/20/5/730/2543/Accurate-and-Computationally-Efficient-Algorithms</code>.</p></li>
</ul></div>
    <div class="section level2">
    <h2 id="see-also">See also<a class="anchor" aria-label="anchor" href="#see-also"></a></h2>
    <div class="dont-index"><p><code><a href="plotTS.html">plotTS()</a></code>, which calls this.</p></div>
    </div>
    <div class="section level2">
    <h2 id="author">Author<a class="anchor" aria-label="anchor" href="#author"></a></h2>
    <p>Dan Kelley</p>
    </div>

  </main><aside class="col-md-3"><nav id="toc" aria-label="Table of contents"><h2>On this page</h2>
    </nav></aside></div>


    <footer><div class="pkgdown-footer-left">
  <p>Developed by Dan Kelley, Clark Richards.</p>
</div>

<div class="pkgdown-footer-right">
  <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.0.9000.</p>
</div>

    </footer></div>





  </body></html>

