<!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"><meta name="description" content="Adds model fits from iterations of the nls algorithm as returned when trace=TRUE. Useful for diagnosing model fitting problems or issues associated with starting values."><title>Adds model fits from nls iterations to active plot. — nlsTracePlot • FSA</title><!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png"><link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png"><link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../apple-touch-icon.png"><link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png"><link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png"><link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png"><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.2.2/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.2.2/bootstrap.bundle.min.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous"><!-- bootstrap-toc --><script src="https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@v1.0.1/dist/bootstrap-toc.min.js" integrity="sha256-4veVQbu7//Lk5TSmc7YV48MxtMy98e26cf5MrgZYnwo=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- search --><script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/6.4.6/fuse.js" integrity="sha512-zv6Ywkjyktsohkbp9bb45V6tEMoWhzFzXis+LrMehmJZZSys19Yxf1dopHx7WzIKxr5tK2dVcYmaCk2uqdjF4A==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/autocomplete.js/0.38.0/autocomplete.jquery.min.js" integrity="sha512-GU9ayf+66Xx2TmpxqJpliWbT5PiGYxpaG8rfnBEk1LL8l1KGkRShhngwdXK1UgqhAzWpZHSiYPc09/NwDQIGyg==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/mark.min.js" integrity="sha512-5CYOlHXGh6QpOFA/TeTylKLWfB3ftPsde7AnmhuitiTX4K5SqCLBeKro6sPS8ilsz1Q4NRx3v8Ko2IBiszzdww==" crossorigin="anonymous"></script><!-- pkgdown --><script src="../pkgdown.js"></script><meta property="og:title" content="Adds model fits from nls iterations to active plot. — nlsTracePlot"><meta property="og:description" content="Adds model fits from iterations of the nls algorithm as returned when trace=TRUE. Useful for diagnosing model fitting problems or issues associated with starting values."><meta property="og:image" content="https://fishr-core-team.github.io/FSA/logo.png"><!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]--></head><body>
    <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
    

    <nav class="navbar fixed-top navbar-dark navbar-expand-lg bg-primary"><div class="container">
    
    <a class="navbar-brand me-2" href="../index.html">FSA</a>

    <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Released version">0.9.5</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>
      </ul><form class="form-inline my-2 my-lg-0" role="search">
        <input type="search" class="form-control me-sm-2" aria-label="Toggle navigation" name="search-input" data-search-index="../search.json" id="search-input" placeholder="Search for" autocomplete="off"></form>

      <ul class="navbar-nav"><li class="nav-item">
  <a class="nav-link" href="../news/index.html">
    <span class="fa fa-newspaper"></span>
     
  </a>
</li>
<li class="nav-item">
  <a class="nav-link" href="../index.html">
    <span class="fa fa-home fa"></span>
     
  </a>
</li>
<li class="nav-item">
  <a class="external-link nav-link" href="https://github.com/fishR-Core-Team/FSA">
    <span class="fa fa-github fa"></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">
      <img src="../logo.png" class="logo" alt=""><h1>Adds model fits from nls iterations to active plot.</h1>
      <small class="dont-index">Source: <a href="https://github.com/fishR-Core-Team/FSA/blob/HEAD/R/nlsTracePlot.R" class="external-link"><code>R/nlsTracePlot.R</code></a></small>
      <div class="d-none name"><code>nlsTracePlot.Rd</code></div>
    </div>

    <div class="ref-description section level2">
    <p>Adds model fits from iterations of the <code><a href="https://rdrr.io/r/stats/nls.html" class="external-link">nls</a></code> algorithm as returned when <code>trace=TRUE</code>. Useful for diagnosing model fitting problems or issues associated with starting values.</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">nlsTracePlot</span><span class="op">(</span></span>
<span>  <span class="va">object</span>,</span>
<span>  <span class="va">fun</span>,</span>
<span>  from <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span>  to <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span>  n <span class="op">=</span> <span class="fl">199</span>,</span>
<span>  lwd <span class="op">=</span> <span class="fl">2</span>,</span>
<span>  col <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span>  rev.col <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span>  legend <span class="op">=</span> <span class="st">"topright"</span>,</span>
<span>  cex.leg <span class="op">=</span> <span class="fl">0.9</span>,</span>
<span>  box.lty.leg <span class="op">=</span> <span class="fl">0</span>,</span>
<span>  add <span class="op">=</span> <span class="cn">TRUE</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>object</dt>
<dd><p>An object saved from <code><a href="https://rdrr.io/r/stats/nls.html" class="external-link">nls</a></code> or from <code><a href="https://rdrr.io/r/utils/capture.output.html" class="external-link">capture.output</a></code> using <code><a href="https://rdrr.io/r/base/try.html" class="external-link">try</a></code> with <code><a href="https://rdrr.io/r/stats/nls.html" class="external-link">nls</a></code>. See details.</p></dd>


<dt>fun</dt>
<dd><p>A function that represents the model being fit in <code><a href="https://rdrr.io/r/stats/nls.html" class="external-link">nls</a></code>. This must take the x-axis variable as the first argument and model parameters as a vector in the second argument. See details.</p></dd>


<dt>from, to</dt>
<dd><p>The range over which the function will be plotted. Defaults to range of the x-axis of the active plot.</p></dd>


<dt>n</dt>
<dd><p>The number of value at which to evaluate the function for plotting (i.e., the number of values from <code>from</code> to <code>to</code>). Larger values make smoother lines.</p></dd>


<dt>lwd</dt>
<dd><p>A numeric used to indicate the line width of the fitted line.</p></dd>


<dt>col</dt>
<dd><p>A single character string that is a palette from <code><a href="https://rdrr.io/r/grDevices/palettes.html" class="external-link">hcl.pals</a></code> or a vector of character strings containing colors for the fitted lines at each trace.</p></dd>


<dt>rev.col</dt>
<dd><p>A logical that indicates that the order of colors for plotting the lines should be reversed.</p></dd>


<dt>legend</dt>
<dd><p>Controls use and placement of the legend. See details.</p></dd>


<dt>cex.leg</dt>
<dd><p>A single numeric value that represents the character expansion value for the legend. Ignored if <code>legend=FALSE</code>.</p></dd>


<dt>box.lty.leg</dt>
<dd><p>A single numeric values that indicates the type of line to use for the box around the legend. The default is to not plot a box.</p></dd>


<dt>add</dt>
<dd><p>A logical indicating whether the lines should be added to the existing plot (defaults to <code>=TRUE</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 matrix with the residual sum-of-squares in the first column and parameter estimates in the remaining columns for each iteration (rows) of <code><a href="https://rdrr.io/r/stats/nls.html" class="external-link">nls</a></code> as provided when <code>trace=TRUE</code>.</p>
    </div>
    <div class="section level2">
    <h2 id="details">Details<a class="anchor" aria-label="anchor" href="#details"></a></h2>
    <p>Nonlinear models fit with the <code><a href="https://rdrr.io/r/stats/nls.html" class="external-link">nls</a></code> function start with starting values for model parameters and iteratively search for other model parameters that continuously reduce the residual sum-of-squares (RSS) until some pre-determined criterion suggest that the RSS cannot be (substantially) further reduced. With good starting values and well-behaved data, the minimum RSS may be found in a few (&lt;10) iterations. However, poor starting values or poorly behaved data may lead to a prolonged and possibly failed search. An understanding of the iterations in a prolonged or failed search may help identify the failure and lead to choices that may result in a successful search. The <code>trace=TRUE</code> argument of <code><a href="https://rdrr.io/r/stats/nls.html" class="external-link">nls</a></code> allows one to see the values at each iterative step. The function documented here plots the “trace” results at each iteration on a previously existing plot of the data. This creates a visual of the iterative process.</p>
<p>The <code>object</code> argument may be an object saved from a successful run of <code><a href="https://rdrr.io/r/stats/nls.html" class="external-link">nls</a></code>. See the examples with <code>SpotVA1</code> and <code>CodNorwegion</code>.</p>
<p>However, if <code><a href="https://rdrr.io/r/stats/nls.html" class="external-link">nls</a></code> fails to converge to a solution then no useful object is returned. In this case, <code>trace=TRUE</code> must be added to the failed <code><a href="https://rdrr.io/r/stats/nls.html" class="external-link">nls</a></code> call. The call is then wrapped in <code><a href="https://rdrr.io/r/base/try.html" class="external-link">try</a></code> to work-around the failed convergence error. This is also wrapped in <code><a href="https://rdrr.io/r/utils/capture.output.html" class="external-link">capture.output</a></code> to capture the “trace” results. This is then saved to an object that which can then be the <code>object</code> of the function documented here. This process is illustrated with the example using <code>BSkateGB</code>.</p>
<p>The function in <code>fun</code> is used to make predictions given the model parameter values at each step of the iteration. This function must accept the explanatory/independent variable as its first argument and values for all model parameters in a vector as its second argument. These types of functions are returned by <code><a href="growthModels.html">vbFuns</a></code>, <code><a href="growthModels.html">GompertzFuns</a></code>, <code><a href="growthModels.html">logisticFuns</a></code>, and <code><a href="growthModels.html">RichardsFuns</a></code> for common growth models and <code><a href="srFuns.html">srFuns</a></code> for common stock-recruitment models. See the examples.</p>
    </div>
    <div class="section level2">
    <h2 id="note">Note<a class="anchor" aria-label="anchor" href="#note"></a></h2>
    <p>The position of the “legend” can be controlled in three ways. First, if <code>legend=TRUE</code>, then the R console is suspended until the user places the legend on the plot by clicking on the point where the upper-left corner of the legend should appear. Second, <code>legend=</code> can be set to one of <code>"bottomright"</code>, <code>"bottom"</code>, <code>"bottomleft"</code>, <code>"left"</code>, <code>"topleft"</code>, <code>"top"</code>, <code>"topright"</code>, <code>"right"</code> and <code>"center"</code>. In this case, the legend will be placed inside the plot frame at the given location. Finally, <code>legend=</code> can be set to a vector of length two which identifies the plot coordinates for the upper-left corner of where the legend should be placed. A legend will not be drawn if <code>legend=FALSE</code> or <code>legend=NULL</code>.</p>
    </div>
    <div class="section level2">
    <h2 id="author">Author<a class="anchor" aria-label="anchor" href="#author"></a></h2>
    <p>Derek H. Ogle, <a href="mailto:DerekOgle51@gmail.com">DerekOgle51@gmail.com</a></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="co">## Examples following a successful fit</span></span></span>
<span class="r-in"><span><span class="va">vb1</span> <span class="op">&lt;-</span> <span class="fu"><a href="growthModels.html">vbFuns</a></span><span class="op">(</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">fit1</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/stats/nls.html" class="external-link">nls</a></span><span class="op">(</span><span class="va">tl</span><span class="op">~</span><span class="fu">vb1</span><span class="op">(</span><span class="va">age</span>,<span class="va">Linf</span>,<span class="va">K</span>,<span class="va">t0</span><span class="op">)</span>,data<span class="op">=</span><span class="va">SpotVA1</span>,start<span class="op">=</span><span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">list</a></span><span class="op">(</span>Linf<span class="op">=</span><span class="fl">12</span>,K<span class="op">=</span><span class="fl">0.3</span>,t0<span class="op">=</span><span class="fl">0</span><span class="op">)</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">tl</span><span class="op">~</span><span class="va">age</span>,data<span class="op">=</span><span class="va">SpotVA1</span>,pch<span class="op">=</span><span class="fl">21</span>,bg<span class="op">=</span><span class="st">"gray40"</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="fu">nlsTracePlot</span><span class="op">(</span><span class="va">fit1</span>,<span class="va">vb1</span>,legend<span class="op">=</span><span class="st">"bottomright"</span><span class="op">)</span></span></span>
<span class="r-plt img"><img src="nlsTracePlot-1.png" alt="" width="700" height="433"></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="va">r1</span> <span class="op">&lt;-</span> <span class="fu"><a href="srFuns.html">srFuns</a></span><span class="op">(</span><span class="st">"Ricker"</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">fitSR1</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/stats/nls.html" class="external-link">nls</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/Log.html" class="external-link">log</a></span><span class="op">(</span><span class="va">recruits</span><span class="op">)</span><span class="op">~</span><span class="fu"><a href="https://rdrr.io/r/base/Log.html" class="external-link">log</a></span><span class="op">(</span><span class="fu">r1</span><span class="op">(</span><span class="va">stock</span>,<span class="va">a</span>,<span class="va">b</span><span class="op">)</span><span class="op">)</span>,data<span class="op">=</span><span class="va">CodNorwegian</span>,start<span class="op">=</span><span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">list</a></span><span class="op">(</span>a<span class="op">=</span><span class="fl">3</span>,b<span class="op">=</span><span class="fl">0.03</span><span class="op">)</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">recruits</span><span class="op">~</span><span class="va">stock</span>,data<span class="op">=</span><span class="va">CodNorwegian</span>,pch<span class="op">=</span><span class="fl">21</span>,bg<span class="op">=</span><span class="st">"gray40"</span>,xlim<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">0</span>,<span class="fl">200</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="fu">nlsTracePlot</span><span class="op">(</span><span class="va">fitSR1</span>,<span class="va">r1</span><span class="op">)</span></span></span>
<span class="r-plt img"><img src="nlsTracePlot-2.png" alt="" width="700" height="433"></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># no plot, but returns trace results as a matrix</span></span></span>
<span class="r-in"><span><span class="op">(</span> <span class="va">tmp</span> <span class="op">&lt;-</span> <span class="fu">nlsTracePlot</span><span class="op">(</span><span class="va">fitSR1</span>,<span class="va">r1</span>,add<span class="op">=</span><span class="cn">FALSE</span><span class="op">)</span> <span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>          [,1]       [,2]</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1,] 3.000000 0.03000000</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [2,] 5.038795 0.01836117</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [3,] 5.850261 0.01836117</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [4,] 5.918852 0.01836117</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [5,] 5.919256 0.01836117</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="kw">if</span> <span class="op">(</span><span class="cn">FALSE</span><span class="op">)</span> <span class="op">{</span></span></span>
<span class="r-in"><span><span class="kw">if</span> <span class="op">(</span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">require</a></span><span class="op">(</span><span class="va"><a href="https://fishr-core-team.github.io/FSAdata/">FSAdata</a></span><span class="op">)</span><span class="op">)</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">BSkateGB</span>,package<span class="op">=</span><span class="st">"FSAdata"</span><span class="op">)</span></span></span>
<span class="r-in"><span>  <span class="va">wtr</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/droplevels.html" class="external-link">droplevels</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/subset.html" class="external-link">subset</a></span><span class="op">(</span><span class="va">BSkateGB</span>,<span class="va">season</span><span class="op">==</span><span class="st">"winter"</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-in"><span>  <span class="va">bh1</span> <span class="op">&lt;-</span> <span class="fu"><a href="srFuns.html">srFuns</a></span><span class="op">(</span><span class="op">)</span></span></span>
<span class="r-in"><span>  <span class="va">trc</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/utils/capture.output.html" class="external-link">capture.output</a></span><span class="op">(</span><span class="kw"><a href="https://rdrr.io/r/base/try.html" class="external-link">try</a></span><span class="op">(</span></span></span>
<span class="r-in"><span>  <span class="va">fitSR1</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/stats/nls.html" class="external-link">nls</a></span><span class="op">(</span><span class="va">recruits</span><span class="op">~</span><span class="fu">bh1</span><span class="op">(</span><span class="va">spawners</span>,<span class="va">a</span>,<span class="va">b</span><span class="op">)</span>,<span class="va">wtr</span>,</span></span>
<span class="r-in"><span>                start<span class="op">=</span><span class="fu"><a href="srStarts.html">srStarts</a></span><span class="op">(</span><span class="va">recruits</span><span class="op">~</span><span class="va">spawners</span>,data<span class="op">=</span><span class="va">wtr</span><span class="op">)</span>,trace<span class="op">=</span><span class="cn">TRUE</span><span class="op">)</span></span></span>
<span class="r-in"><span>  <span class="op">)</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">recruits</span><span class="op">~</span><span class="va">spawners</span>,data<span class="op">=</span><span class="va">wtr</span>,pch<span class="op">=</span><span class="fl">21</span>,bg<span class="op">=</span><span class="st">"gray40"</span><span class="op">)</span></span></span>
<span class="r-in"><span>  <span class="fu">nlsTracePlot</span><span class="op">(</span><span class="va">trc</span>,<span class="va">bh1</span><span class="op">)</span></span></span>
<span class="r-in"><span>  <span class="co"># zoom in on y-axis</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">recruits</span><span class="op">~</span><span class="va">spawners</span>,data<span class="op">=</span><span class="va">wtr</span>,pch<span class="op">=</span><span class="fl">21</span>,bg<span class="op">=</span><span class="st">"gray40"</span>,ylim<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">0.02</span>,<span class="fl">0.05</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-in"><span>  <span class="fu">nlsTracePlot</span><span class="op">(</span><span class="va">trc</span>,<span class="va">bh1</span>,legend<span class="op">=</span><span class="st">"top"</span><span class="op">)</span></span></span>
<span class="r-in"><span>  <span class="co"># return just the trace results</span></span></span>
<span class="r-in"><span>  <span class="op">(</span> <span class="va">tmp</span> <span class="op">&lt;-</span> <span class="fu">nlsTracePlot</span><span class="op">(</span><span class="va">trc</span>,<span class="va">bh1</span>,add<span class="op">=</span><span class="cn">FALSE</span><span class="op">)</span> <span class="op">)</span></span></span>
<span class="r-in"><span><span class="op">}</span></span></span>
<span class="r-in"><span><span class="op">}</span></span></span>
<span class="r-in"><span></span></span>
</code></pre></div>
    </div>
  </main><aside class="col-md-3"><nav id="toc"><h2>On this page</h2>
    </nav></aside></div>


    <footer><div class="pkgdown-footer-left">
  <p></p><p>Developed by <a href="http://derekogle.com" class="external-link">Derek H. Ogle</a>, Jason C. Doll, A. Powell Wheeler, Alexis Dinno.</p>
</div>

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

    </footer></div>

  

  

  </body></html>

