<!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>Plot an echosounder Object — plot,echosounder-method • 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="Plot an echosounder Object — plot,echosounder-method"><meta name="description" content="Plot echosounder data.
Simple linear approximation is used when a newx value is specified
with the which=2 method, but arguably a gridding method should be
used, and this may be added in the future."><meta property="og:description" content="Plot echosounder data.
Simple linear approximation is used when a newx value is specified
with the which=2 method, but arguably a gridding method should be
used, and this may be added in the future."></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>Plot an echosounder Object</h1>
      <small class="dont-index">Source: <a href="https://github.com/dankelley/oce/blob/HEAD/R/echosounder.R" class="external-link"><code>R/echosounder.R</code></a></small>
      <div class="d-none name"><code>plot-echosounder-method.Rd</code></div>
    </div>

    <div class="ref-description section level2">
    <p>Plot echosounder data.
Simple linear approximation is used when a <code>newx</code> value is specified
with the <code>which=2</code> method, but arguably a gridding method should be
used, and this may be added in the future.</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="co"># S4 method for class 'echosounder'</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span></span>
<span>  <span class="va">x</span>,</span>
<span>  which <span class="op">=</span> <span class="fl">1</span>,</span>
<span>  beam <span class="op">=</span> <span class="st">"a"</span>,</span>
<span>  <span class="va">newx</span>,</span>
<span>  <span class="va">xlab</span>,</span>
<span>  <span class="va">ylab</span>,</span>
<span>  <span class="va">xlim</span>,</span>
<span>  <span class="va">ylim</span>,</span>
<span>  <span class="va">zlim</span>,</span>
<span>  type <span class="op">=</span> <span class="st">"l"</span>,</span>
<span>  <span class="va">col</span>,</span>
<span>  lwd <span class="op">=</span> <span class="fl">2</span>,</span>
<span>  despike <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span>  <span class="va">drawBottom</span>,</span>
<span>  ignore <span class="op">=</span> <span class="fl">5</span>,</span>
<span>  drawTimeRange <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span>  drawPalette <span class="op">=</span> <span class="cn">TRUE</span>,</span>
<span>  <span class="va">radius</span>,</span>
<span>  <span class="va">coastline</span>,</span>
<span>  mgp <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">"oceMgp"</span><span class="op">)</span>,</span>
<span>  mar <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="va">mgp</span><span class="op">[</span><span class="fl">1</span><span class="op">]</span>, <span class="va">mgp</span><span class="op">[</span><span class="fl">1</span><span class="op">]</span> <span class="op">+</span> <span class="fl">1.5</span>, <span class="va">mgp</span><span class="op">[</span><span class="fl">2</span><span class="op">]</span> <span class="op">+</span> <span class="fl">1</span><span class="op">/</span><span class="fl">2</span>, <span class="fl">1</span><span class="op">/</span><span class="fl">2</span><span class="op">)</span>,</span>
<span>  <span class="va">atTop</span>,</span>
<span>  <span class="va">labelsTop</span>,</span>
<span>  <span class="va">tformat</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="va">...</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-x">x<a class="anchor" aria-label="anchor" href="#arg-x"></a></dt>
<dd><p>an <a href="echosounder-class.html">echosounder</a> object.</p></dd>


<dt id="arg-which">which<a class="anchor" aria-label="anchor" href="#arg-which"></a></dt>
<dd><p>list of desired plot types: <code>which=1</code> or <code>which="zt
image"</code> gives a z-time image, <code>which=2</code> or <code>which="zx image"</code>
gives a z-distance image, and <code>which=3</code> or <code>which="map"</code> gives a
map showing the cruise track.  In the image plots, the display is of
<code><a href="https://rdrr.io/r/base/Log.html" class="external-link">log10()</a></code> of amplitude, trimmed to zero for any amplitude values
less than 1 (including missing values, which equal 0).  Add 10 to the
numeric codes to get the secondary data (non-existent for single-beam files,</p></dd>


<dt id="arg-beam">beam<a class="anchor" aria-label="anchor" href="#arg-beam"></a></dt>
<dd><p>a more detailed specification of the data to be plotted.  For
single-beam data, this may only be <code>"a"</code>.  For dual-beam data, this may
be <code>"a"</code> for the narrow-beam signal, or <code>"b"</code> for the wide-beam
signal.  For split-beam data, this may be <code>"a"</code> for amplitude,
<code>"b"</code> for x-angle data, or <code>"c"</code> for y-angle data.</p></dd>


<dt id="arg-newx">newx<a class="anchor" aria-label="anchor" href="#arg-newx"></a></dt>
<dd><p>optional vector of values to appear on the horizontal axis if
<code>which=1</code>, instead of time.  This must be of the same length as the
time vector, because the image is remapped from time to <code>newx</code> using
<code><a href="https://rdrr.io/r/stats/approxfun.html" class="external-link">approx()</a></code>.</p></dd>


<dt id="arg-xlab-ylab">xlab, ylab<a class="anchor" aria-label="anchor" href="#arg-xlab-ylab"></a></dt>
<dd><p>optional labels for the horizontal and vertical axes; if
not provided, the labels depend on the value of <code>which</code>.</p></dd>


<dt id="arg-xlim">xlim<a class="anchor" aria-label="anchor" href="#arg-xlim"></a></dt>
<dd><p>optional range for x axis.</p></dd>


<dt id="arg-ylim">ylim<a class="anchor" aria-label="anchor" href="#arg-ylim"></a></dt>
<dd><p>optional range for y axis.</p></dd>


<dt id="arg-zlim">zlim<a class="anchor" aria-label="anchor" href="#arg-zlim"></a></dt>
<dd><p>optional range for color scale.</p></dd>


<dt id="arg-type">type<a class="anchor" aria-label="anchor" href="#arg-type"></a></dt>
<dd><p>type of graph, <code>"l"</code> for line, <code>"p"</code> for points, or
<code>"b"</code> for both.</p></dd>


<dt id="arg-col">col<a class="anchor" aria-label="anchor" href="#arg-col"></a></dt>
<dd><p>a function providing the color scale for image plots.
This value is passed to <code><a href="imagep.html">imagep()</a></code>, which draws
the images.  Since <code><a href="imagep.html">imagep()</a></code> defaults <code>col</code> to
<code><a href="oceColorsViridis.html">oceColorsViridis()</a></code>, that is effectively also the default
for the present function. (Prior to 2023-03-18, the present
function defaulted <code>col</code> to <code><a href="oceColorsJet.html">oceColorsJet()</a></code>.)</p></dd>


<dt id="arg-lwd">lwd<a class="anchor" aria-label="anchor" href="#arg-lwd"></a></dt>
<dd><p>line width (ignored if <code>type="p"</code>).</p></dd>


<dt id="arg-despike">despike<a class="anchor" aria-label="anchor" href="#arg-despike"></a></dt>
<dd><p>remove vertical banding by using <code><a href="https://rdrr.io/r/stats/smooth.html" class="external-link">smooth()</a></code> to
smooth across image columns, row by row.</p></dd>


<dt id="arg-drawbottom">drawBottom<a class="anchor" aria-label="anchor" href="#arg-drawbottom"></a></dt>
<dd><p>optional flag used for section images.  If <code>TRUE</code>,
then the bottom is inferred as a smoothed version of the ridge of highest
image value, and data below that are grayed out after the image is drawn.
If <code>drawBottom</code> is a color, then that color is used, instead of
white.  The bottom is detected with <code><a href="findBottom.html">findBottom()</a></code>, using the
<code>ignore</code> value described next.</p></dd>


<dt id="arg-ignore">ignore<a class="anchor" aria-label="anchor" href="#arg-ignore"></a></dt>
<dd><p>optional flag specifying the thickness in metres of a surface
region to be ignored during the bottom-detection process.  This is ignored
unless <code>drawBottom=TRUE</code>.</p></dd>


<dt id="arg-drawtimerange">drawTimeRange<a class="anchor" aria-label="anchor" href="#arg-drawtimerange"></a></dt>
<dd><p>if <code>TRUE</code>, the time range will be drawn at the
top.  Ignored except for <code>which=2</code>, i.e. distance-depth plots.</p></dd>


<dt id="arg-drawpalette">drawPalette<a class="anchor" aria-label="anchor" href="#arg-drawpalette"></a></dt>
<dd><p>if <code>TRUE</code>, the palette will be drawn.</p></dd>


<dt id="arg-radius">radius<a class="anchor" aria-label="anchor" href="#arg-radius"></a></dt>
<dd><p>radius to use for maps; ignored unless <code>which=3</code> or
<code>which="map"</code>.</p></dd>


<dt id="arg-coastline">coastline<a class="anchor" aria-label="anchor" href="#arg-coastline"></a></dt>
<dd><p>coastline to use for maps; ignored unless <code>which=3</code> or
<code>which="map"</code>.</p></dd>


<dt id="arg-mgp">mgp<a class="anchor" aria-label="anchor" href="#arg-mgp"></a></dt>
<dd><p>3-element numerical vector to use for <code><a href="https://rdrr.io/r/graphics/par.html" class="external-link">par</a></code><code>("mgp")</code>, and also
for <code><a href="https://rdrr.io/r/graphics/par.html" class="external-link">par</a></code><code>("mar")</code>, 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.</p></dd>


<dt id="arg-mar">mar<a class="anchor" aria-label="anchor" href="#arg-mar"></a></dt>
<dd><p>value to be used with <code><a href="https://rdrr.io/r/graphics/par.html" class="external-link">par</a></code><code>("mar")</code>.</p></dd>


<dt id="arg-attop">atTop<a class="anchor" aria-label="anchor" href="#arg-attop"></a></dt>
<dd><p>optional vector of time values, for labels at the top of the
plot produced with <code>which=2</code>.  If <code>labelsTop</code> is provided, then it
will hold the labels.  If <code>labelsTop</code> is not provided, the labels will
be constructed with the <code><a href="https://rdrr.io/r/base/format.html" class="external-link">format()</a></code> function, and these may be
customized by supplying a <code>format</code> in the <code>...</code> arguments.</p></dd>


<dt id="arg-labelstop">labelsTop<a class="anchor" aria-label="anchor" href="#arg-labelstop"></a></dt>
<dd><p>optional vector of character strings to be plotted above
the <code>atTop</code> times.  Ignored unless <code>atTop</code> was provided.</p></dd>


<dt id="arg-tformat">tformat<a class="anchor" aria-label="anchor" href="#arg-tformat"></a></dt>
<dd><p>optional argument passed to <code><a href="imagep.html">imagep()</a></code>, for plot
types that call that function.  (See <code><a href="https://rdrr.io/r/base/strptime.html" class="external-link">strptime()</a></code> for the format
used.)</p></dd>


<dt id="arg-debug">debug<a class="anchor" aria-label="anchor" href="#arg-debug"></a></dt>
<dd><p>set to an integer exceeding zero, to get debugging information
during processing.</p></dd>


<dt id="arg--">...<a class="anchor" aria-label="anchor" href="#arg--"></a></dt>
<dd><p>optional arguments passed to plotting functions.  For example,
for maps, it is possible to specify the radius of the view in kilometres,
with <code>radius</code>.</p></dd>

</dl></div>
    <div class="section level2">
    <h2 id="value">Value<a class="anchor" aria-label="anchor" href="#value"></a></h2>
    <p>A list is silently returned, containing <code>xat</code> and <code>yat</code>,
values that can be used by <code><a href="oce.grid.html">oce.grid()</a></code> to add a grid to the plot.</p>
    </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>Other things related to echosounder data:
<code><a href="sub-sub-echosounder-method.html">[[,echosounder-method</a></code>,
<code>[[&lt;-,echosounder-method</code>,
<code><a href="as.echosounder.html">as.echosounder</a>()</code>,
<code><a href="echosounder.html">echosounder</a></code>,
<code><a href="echosounder-class.html">echosounder-class</a></code>,
<code><a href="findBottom.html">findBottom</a>()</code>,
<code><a href="read.echosounder.html">read.echosounder</a>()</code>,
<code><a href="subset-echosounder-method.html">subset,echosounder-method</a></code>,
<code><a href="summary-echosounder-method.html">summary,echosounder-method</a></code></p></div>
    </div>
    <div class="section level2">
    <h2 id="author">Author<a class="anchor" aria-label="anchor" href="#author"></a></h2>
    <p>Dan Kelley, with extensive help from Clark Richards</p>
    </div>

    <div class="section level2">
    <h2 id="ref-examples">Examples<a class="anchor" aria-label="anchor" href="#ref-examples"></a></h2>
    <div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">library</a></span><span class="op">(</span><span class="va"><a href="https://dankelley.github.io/oce/">oce</a></span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/utils/data.html" class="external-link">data</a></span><span class="op">(</span><span class="va">echosounder</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span><span class="va">echosounder</span>, drawBottom <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></span>
<span class="r-plt img"><img src="plot-echosounder-method-1.png" alt="" width="700" height="700"></span>
<span class="r-in"><span></span></span>
</code></pre></div>
    </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>

