<!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='A combination of stat_slabinterval() and geom_lineribbon() with sensible defaults
for making line + multiple-ribbon plots. While geom_lineribbon() is intended for use on data
frames that have already been summarized using a point_interval() function,
stat_lineribbon() is intended for use directly on data frames of draws or of
analytical distributions, and will perform the summarization using a point_interval()
function.
Roughly equivalent to:
stat_slabinterval(
  aes(
    group = after_stat(level),
    fill = after_stat(level),
    order = after_stat(level),
    size = NULL
  ),
  geom = "lineribbon",
  .width = c(0.5, 0.8, 0.95),
  show_slab = FALSE,
  show.legend = NA
)
'><title>Line + multiple-ribbon plot (shortcut stat) — stat_lineribbon • ggdist</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.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/Source_Sans_Pro-0.4.8/font.css" rel="stylesheet"><link href="../deps/Source_Code_Pro-0.4.8/font.css" rel="stylesheet"><!-- 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="Line + multiple-ribbon plot (shortcut stat) — stat_lineribbon"><meta property="og:description" content='A combination of stat_slabinterval() and geom_lineribbon() with sensible defaults
for making line + multiple-ribbon plots. While geom_lineribbon() is intended for use on data
frames that have already been summarized using a point_interval() function,
stat_lineribbon() is intended for use directly on data frames of draws or of
analytical distributions, and will perform the summarization using a point_interval()
function.
Roughly equivalent to:
stat_slabinterval(
  aes(
    group = after_stat(level),
    fill = after_stat(level),
    order = after_stat(level),
    size = NULL
  ),
  geom = "lineribbon",
  .width = c(0.5, 0.8, 0.95),
  show_slab = FALSE,
  show.legend = NA
)
'><meta property="og:image" content="http://mjskay.github.io/ggdist/logo.svg"><!-- 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]--><!-- Global site tag (gtag.js) - Google Analytics --><script async src="https://www.googletagmanager.com/gtag/js?id=UA-93322-5"></script><script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-93322-5');
</script></head><body>
    <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
    

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

    <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">3.3.2</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">
  <a href="#" class="nav-link dropdown-toggle" data-bs-toggle="dropdown" role="button" aria-expanded="false" aria-haspopup="true" id="dropdown-articles">Articles</a>
  <div class="dropdown-menu" aria-labelledby="dropdown-articles">
    <a class="dropdown-item" href="../articles/dotsinterval.html">Dots + interval stats and geoms</a>
    <a class="dropdown-item" href="../articles/freq-uncertainty-vis.html">Frequentist uncertainty visualization</a>
    <a class="dropdown-item" href="../articles/lineribbon.html">Lineribbon stats and geoms</a>
    <a class="dropdown-item" href="../articles/slabinterval.html">Slab + interval stats and geoms</a>
    <a class="dropdown-item" href="../articles/thickness.html">Thickness scale</a>
  </div>
</li>
<li class="nav-item">
  <a class="nav-link" href="../news/index.html">Changelog</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="external-link nav-link" href="https://github.com/mjskay/ggdist/" aria-label="github">
    <span class="fab 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">
      <img src="../logo.svg" class="logo" alt=""><h1>Line + multiple-ribbon plot (shortcut stat)</h1>
      <small class="dont-index">Source: <a href="https://github.com/mjskay/ggdist/blob/HEAD/R/stat_lineribbon.R" class="external-link"><code>R/stat_lineribbon.R</code></a></small>
      <div class="d-none name"><code>stat_lineribbon.Rd</code></div>
    </div>

    <div class="ref-description section level2">
    <p>A combination of <code><a href="stat_slabinterval.html">stat_slabinterval()</a></code> and <code><a href="geom_lineribbon.html">geom_lineribbon()</a></code> with sensible defaults
for making line + multiple-ribbon plots. While <code><a href="geom_lineribbon.html">geom_lineribbon()</a></code> is intended for use on data
frames that have already been summarized using a <code><a href="point_interval.html">point_interval()</a></code> function,
<code>stat_lineribbon()</code> is intended for use directly on data frames of draws or of
analytical distributions, and will perform the summarization using a <code><a href="point_interval.html">point_interval()</a></code>
function.</p>
<p><strong>Roughly equivalent to:</strong></p>
<div class="sourceCode"><pre><code><span><span class="fu"><a href="../reference/stat_slabinterval.html">stat_slabinterval</a></span><span class="op">(</span></span>
<span>  <span class="fu"><a href="https://ggplot2.tidyverse.org/reference/aes.html" class="external-link">aes</a></span><span class="op">(</span></span>
<span>    group <span class="op">=</span> <span class="fu"><a href="https://ggplot2.tidyverse.org/reference/aes_eval.html" class="external-link">after_stat</a></span><span class="op">(</span><span class="va">level</span><span class="op">)</span>,</span>
<span>    fill <span class="op">=</span> <span class="fu"><a href="https://ggplot2.tidyverse.org/reference/aes_eval.html" class="external-link">after_stat</a></span><span class="op">(</span><span class="va">level</span><span class="op">)</span>,</span>
<span>    order <span class="op">=</span> <span class="fu"><a href="https://ggplot2.tidyverse.org/reference/aes_eval.html" class="external-link">after_stat</a></span><span class="op">(</span><span class="va">level</span><span class="op">)</span>,</span>
<span>    size <span class="op">=</span> <span class="cn">NULL</span></span>
<span>  <span class="op">)</span>,</span>
<span>  geom <span class="op">=</span> <span class="st">"lineribbon"</span>,</span>
<span>  .width <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.5</span>, <span class="fl">0.8</span>, <span class="fl">0.95</span><span class="op">)</span>,</span>
<span>  show_slab <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span>  show.legend <span class="op">=</span> <span class="cn">NA</span></span>
<span><span class="op">)</span></span></code></pre></div>

    </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">stat_lineribbon</span><span class="op">(</span></span>
<span>  mapping <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span>  data <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span>  geom <span class="op">=</span> <span class="st">"lineribbon"</span>,</span>
<span>  position <span class="op">=</span> <span class="st">"identity"</span>,</span>
<span>  <span class="va">...</span>,</span>
<span>  .width <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.5</span>, <span class="fl">0.8</span>, <span class="fl">0.95</span><span class="op">)</span>,</span>
<span>  point_interval <span class="op">=</span> <span class="st">"median_qi"</span>,</span>
<span>  orientation <span class="op">=</span> <span class="cn">NA</span>,</span>
<span>  na.rm <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span>  show.legend <span class="op">=</span> <span class="cn">NA</span>,</span>
<span>  inherit.aes <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>mapping</dt>
<dd><p>Set of aesthetic mappings created by <code><a href="https://ggplot2.tidyverse.org/reference/aes.html" class="external-link">aes()</a></code>. If specified and
<code>inherit.aes = TRUE</code> (the default), it is combined with the default mapping
at the top level of the plot. You must supply <code>mapping</code> if there is no plot
mapping.</p></dd>


<dt>data</dt>
<dd><p>The data to be displayed in this layer. There are three
options:</p>
<p>If <code>NULL</code>, the default, the data is inherited from the plot
data as specified in the call to <code><a href="https://ggplot2.tidyverse.org/reference/ggplot.html" class="external-link">ggplot()</a></code>.</p>
<p>A <code>data.frame</code>, or other object, will override the plot
data. All objects will be fortified to produce a data frame. See
<code><a href="https://ggplot2.tidyverse.org/reference/fortify.html" class="external-link">fortify()</a></code> for which variables will be created.</p>
<p>A <code>function</code> will be called with a single argument,
the plot data. The return value must be a <code>data.frame</code>, and
will be used as the layer data. A <code>function</code> can be created
from a <code>formula</code> (e.g. <code>~ head(.x, 10)</code>).</p></dd>


<dt>geom</dt>
<dd><p>Use to override the default connection between
<code>stat_lineribbon()</code> and <code><a href="geom_lineribbon.html">geom_lineribbon()</a></code></p></dd>


<dt>position</dt>
<dd><p>Position adjustment, either as a string, or the result of a call to a position adjustment function.
Setting this equal to <code>"dodge"</code> (<code><a href="https://ggplot2.tidyverse.org/reference/position_dodge.html" class="external-link">position_dodge()</a></code>) or <code>"dodgejust"</code> (<code><a href="position_dodgejust.html">position_dodgejust()</a></code>) can be useful if
you have overlapping geometries.</p></dd>


<dt>...</dt>
<dd><p>Other arguments passed to <code><a href="https://ggplot2.tidyverse.org/reference/layer.html" class="external-link">layer()</a></code>. These are often aesthetics, used to set an aesthetic
to a fixed value, like <code>colour = "red"</code> or <code>linewidth = 3</code> (see <strong>Aesthetics</strong>, below). They may also be
parameters to the paired geom/stat. When paired with the default geom, <code><a href="geom_lineribbon.html">geom_lineribbon()</a></code>,
these include:</p><dl><dt><code>step</code></dt>
<dd><p>Should the line/ribbon be drawn as a step function? One of:</p><ul><li><p><code>FALSE</code> (default): do not draw as a step function.</p></li>
<li><p><code>"mid"</code> (or <code>TRUE</code>): draw steps midway between adjacent x values.</p></li>
<li><p><code>"hv"</code>: draw horizontal-then-vertical steps.</p></li>
<li><p><code>"vh"</code>: draw as vertical-then-horizontal steps.</p></li>
</ul><p><code>TRUE</code> is an alias for <code>"mid"</code> because for a step function with ribbons, <code>"mid"</code> is probably what you want
(for the other two step approaches the ribbons at either the very first or very last x value will not be
visible).</p></dd>


</dl></dd>


<dt>.width</dt>
<dd><p>The <code>.width</code> argument passed to <code>point_interval</code>: a vector of probabilities to use
that determine the widths of the resulting intervals. If multiple probabilities are provided,
multiple intervals per group are generated, each with a different probability interval (and
value of the corresponding <code>.width</code> and <code>level</code> generated variables).</p></dd>


<dt>point_interval</dt>
<dd><p>A function from the <code><a href="point_interval.html">point_interval()</a></code> family (e.g., <code>median_qi</code>,
<code>mean_qi</code>, <code>mode_hdi</code>, etc), or a string giving the name of a function from that family
(e.g., <code>"median_qi"</code>, <code>"mean_qi"</code>, <code>"mode_hdi"</code>, etc; if a string, the caller's environment is searched
for the function, followed by the <span class="pkg">ggdist</span> environment). This function determines the point summary
(typically mean, median, or mode) and interval type (quantile interval, <code>qi</code>;
highest-density interval, <code>hdi</code>; or highest-density continuous interval, <code>hdci</code>). Output will
be converted to the appropriate <code>x</code>- or <code>y</code>-based aesthetics depending on the value of <code>orientation</code>.
See the <code><a href="point_interval.html">point_interval()</a></code> family of functions for more information.</p></dd>


<dt>orientation</dt>
<dd><p>Whether this geom is drawn horizontally or vertically. One of:</p><ul><li><p><code>NA</code> (default): automatically detect the orientation based on how the aesthetics
are assigned. Automatic detection works most of the time.</p></li>
<li><p><code>"horizontal"</code> (or <code>"y"</code>): draw horizontally, using the <code>y</code> aesthetic to identify different
groups. For each group, uses the <code>x</code>, <code>xmin</code>, <code>xmax</code>, and <code>thickness</code> aesthetics to
draw points, intervals, and slabs.</p></li>
<li><p><code>"vertical"</code> (or <code>"x"</code>): draw vertically, using the <code>x</code> aesthetic to identify different
groups. For each group, uses the <code>y</code>, <code>ymin</code>, <code>ymax</code>, and <code>thickness</code> aesthetics to
draw points, intervals, and slabs.</p></li>
</ul><p>For compatibility with the base ggplot naming scheme for <code>orientation</code>, <code>"x"</code> can be used as an alias
for <code>"vertical"</code> and <code>"y"</code> as an alias for <code>"horizontal"</code> (<span class="pkg">ggdist</span> had an <code>orientation</code> parameter
before base ggplot did, hence the discrepancy).</p></dd>


<dt>na.rm</dt>
<dd><p>If <code>FALSE</code>, the default, missing values are removed with a warning. If <code>TRUE</code>, missing
values are silently removed.</p></dd>


<dt>show.legend</dt>
<dd><p>Should this layer be included in the legends? <code>NA</code>,
the default, includes if any aesthetics are mapped. <code>FALSE</code> never includes,
and <code>TRUE</code> always includes.</p></dd>


<dt>inherit.aes</dt>
<dd><p>If <code>FALSE</code>, 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. <code><a href="https://ggplot2.tidyverse.org/reference/borders.html" class="external-link">borders()</a></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 <a href="https://ggplot2.tidyverse.org/reference/ggplot2-ggproto.html" class="external-link">ggplot2::Stat</a> representing a line + multiple-ribbon geometry which can
be added to a <code><a href="https://ggplot2.tidyverse.org/reference/ggplot.html" class="external-link">ggplot()</a></code> object.</p>
    </div>
    <div class="section level2">
    <h2 id="details">Details<a class="anchor" aria-label="anchor" href="#details"></a></h2>
    <p><strong>To visualize sample data</strong>, such as a data distribution, samples from a
bootstrap distribution, or a Bayesian posterior, you can supply samples to
the <code>x</code> or <code>y</code> aesthetic.</p>
<p><strong>To visualize analytical distributions</strong>, you can use the <code>xdist</code> or <code>ydist</code>
aesthetic. For historical reasons, you can also use <code>dist</code> to specify the distribution, though
this is not recommended as it does not work as well with orientation detection.
These aesthetics can be used as follows:</p><ul><li><p><code>xdist</code>, <code>ydist</code>, and <code>dist</code> can be any distribution object from the <a href="https://pkg.mitchelloharawild.com/distributional/" class="external-link">distributional</a>
package (<code><a href="https://pkg.mitchelloharawild.com/distributional/reference/dist_normal.html" class="external-link">dist_normal()</a></code>, <code><a href="https://pkg.mitchelloharawild.com/distributional/reference/dist_beta.html" class="external-link">dist_beta()</a></code>, etc) or can be a <code><a href="https://mc-stan.org/posterior/reference/rvar.html" class="external-link">posterior::rvar()</a></code> object.
Since these functions are vectorized,
other columns can be passed directly to them in an <code><a href="https://ggplot2.tidyverse.org/reference/aes.html" class="external-link">aes()</a></code> specification; e.g.
<code>aes(dist = dist_normal(mu, sigma))</code> will work if <code>mu</code> and <code>sigma</code> are columns in the
input data frame.</p></li>
<li><p><code>dist</code> can be a character vector giving the distribution name. Then the  <code>arg1</code>, ... <code>arg9</code>
aesthetics (or <code>args</code> as a list column) specify distribution arguments. Distribution names
should correspond to R functions that have <code>"p"</code>, <code>"q"</code>, and <code>"d"</code> functions; e.g. <code>"norm"</code>
is a valid distribution name because R defines the <code><a href="https://rdrr.io/r/stats/Normal.html" class="external-link">pnorm()</a></code>, <code><a href="https://rdrr.io/r/stats/Normal.html" class="external-link">qnorm()</a></code>, and <code><a href="https://rdrr.io/r/stats/Normal.html" class="external-link">dnorm()</a></code>
functions for Normal distributions.</p>
<p>See the <code><a href="parse_dist.html">parse_dist()</a></code> function for a useful way to generate <code>dist</code> and <code>args</code>
values from human-readable distribution specs (like <code>"normal(0,1)"</code>). Such specs are also
produced by other packages (like the <code><a href="https://paul-buerkner.github.io/brms/reference/get_prior.html" class="external-link">brms::get_prior</a></code> function in brms); thus,
<code><a href="parse_dist.html">parse_dist()</a></code> combined with the stats described here can help you visualize the output
of those functions.</p></li>
</ul></div>
    <div class="section level2">
    <h2 id="computed-variables">Computed Variables<a class="anchor" aria-label="anchor" href="#computed-variables"></a></h2>
    

<p>The following variables are computed by this stat and made available for
use in aesthetic specifications (<code><a href="https://ggplot2.tidyverse.org/reference/aes.html" class="external-link">aes()</a></code>) using the <code><a href="https://ggplot2.tidyverse.org/reference/aes_eval.html" class="external-link">after_stat()</a></code>
function or the <code>after_stat</code> argument of <code><a href="https://ggplot2.tidyverse.org/reference/aes_eval.html" class="external-link">stage()</a></code>:</p><ul><li><p><code>x</code> or <code>y</code>: For slabs, the input values to the slab function.
For intervals, the point summary from the interval function. Whether it is <code>x</code> or <code>y</code> depends on <code>orientation</code></p></li>
<li><p><code>xmin</code> or <code>ymin</code>: For intervals, the lower end of the interval from the interval function.</p></li>
<li><p><code>xmax</code> or <code>ymax</code>: For intervals, the upper end of the interval from the interval function.</p></li>
<li><p><code>.width</code>: For intervals, the interval width as a numeric value in <code>[0, 1]</code>.
For slabs, the width of the smallest interval containing that value of the slab.</p></li>
<li><p><code>level</code>: For intervals, the interval width as an ordered factor.
For slabs, the level of the smallest interval containing that value of the slab.</p></li>
<li><p><code>pdf</code>: For slabs, the probability density function (PDF).
If <code>options("ggdist.experimental.slab_data_in_intervals")</code> is <code>TRUE</code>:
For intervals, the PDF at the point summary; intervals also have <code>pdf_min</code> and <code>pdf_max</code>
for the PDF at the lower and upper ends of the interval.</p></li>
<li><p><code>cdf</code>: For slabs, the cumulative distribution function.
If <code>options("ggdist.experimental.slab_data_in_intervals")</code> is <code>TRUE</code>:
For intervals, the CDF at the point summary; intervals also have <code>cdf_min</code> and <code>cdf_max</code>
for the CDF at the lower and upper ends of the interval.</p></li>
</ul></div>
    <div class="section level2">
    <h2 id="aesthetics">Aesthetics<a class="anchor" aria-label="anchor" href="#aesthetics"></a></h2>
    

<p>The line+ribbon <code>stat</code>s and <code>geom</code>s have a wide variety of aesthetics that control
the appearance of their two sub-geometries: the <strong>line</strong> and the <strong>ribbon</strong>.</p>
<p>These <code>stat</code>s support the following aesthetics:</p>
<ul><li><p><code>x</code>: x position of the geometry (when orientation = <code>"vertical"</code>); or sample data to be summarized
(when <code>orientation = "horizontal"</code> with sample data).</p></li>
<li><p><code>y</code>: y position of the geometry (when orientation = <code>"horizontal"</code>); or sample data to be summarized
(when <code>orientation = "vertical"</code> with sample data).</p></li>
<li><p><code>weight</code>: When using samples (i.e. the <code>x</code> and <code>y</code> aesthetics, not <code>xdist</code> or <code>ydist</code>), optional
weights to be applied to each draw.</p></li>
<li><p><code>xdist</code>: When using analytical distributions, distribution to map on the x axis: a <span class="pkg">distributional</span>
object (e.g. <code><a href="https://pkg.mitchelloharawild.com/distributional/reference/dist_normal.html" class="external-link">dist_normal()</a></code>) or a <code><a href="https://mc-stan.org/posterior/reference/rvar.html" class="external-link">posterior::rvar()</a></code> object.</p></li>
<li><p><code>ydist</code>: When using analytical distributions, distribution to map on the y axis: a <span class="pkg">distributional</span>
object (e.g. <code><a href="https://pkg.mitchelloharawild.com/distributional/reference/dist_normal.html" class="external-link">dist_normal()</a></code>) or a <code><a href="https://mc-stan.org/posterior/reference/rvar.html" class="external-link">posterior::rvar()</a></code> object.</p></li>
<li><p><code>dist</code>: When using analytical distributions, a name of a distribution (e.g. <code>"norm"</code>), a
<span class="pkg">distributional</span> object (e.g. <code><a href="https://pkg.mitchelloharawild.com/distributional/reference/dist_normal.html" class="external-link">dist_normal()</a></code>), or a <code><a href="https://mc-stan.org/posterior/reference/rvar.html" class="external-link">posterior::rvar()</a></code> object. See <strong>Details</strong>.</p></li>
<li><p><code>args</code>: Distribution arguments (<code>args</code> or <code>arg1</code>, ... <code>arg9</code>). See <strong>Details</strong>.</p></li>
</ul><p>In addition, in their default configuration (paired with <code><a href="geom_lineribbon.html">geom_lineribbon()</a></code>)
the following aesthetics are supported by the underlying geom:</p>
<p><strong>Ribbon-specific aesthetics</strong></p>
<ul><li><p><code>xmin</code>: Left edge of the ribbon sub-geometry (if <code>orientation = "horizontal"</code>).</p></li>
<li><p><code>xmax</code>: Right edge of the ribbon sub-geometry (if <code>orientation = "horizontal"</code>).</p></li>
<li><p><code>ymin</code>: Lower edge of the ribbon sub-geometry (if <code>orientation = "vertical"</code>).</p></li>
<li><p><code>ymax</code>: Upper edge of the ribbon sub-geometry (if <code>orientation = "vertical"</code>).</p></li>
<li><p><code>order</code>: The order in which ribbons are drawn. Ribbons with the smallest mean value of <code>order</code>
are drawn first (i.e., will be drawn below ribbons with larger mean values of <code>order</code>). If
<code>order</code> is not supplied to <code><a href="geom_lineribbon.html">geom_lineribbon()</a></code>, <code>-abs(xmax - xmin)</code> or <code>-abs(ymax - ymax)</code>
(depending on <code>orientation</code>) is used, having the effect of drawing the widest (on average)
ribbons on the bottom. <code>stat_lineribbon()</code> uses <code>order = after_stat(level)</code> by default,
causing the ribbons generated from the largest <code>.width</code> to be drawn on the bottom.</p></li>
</ul><p><strong>Color aesthetics</strong></p>
<ul><li><p><code>colour</code>: (or <code>color</code>) The color of the <strong>line</strong> sub-geometry.</p></li>
<li><p><code>fill</code>: The fill color of the <strong>ribbon</strong> sub-geometry.</p></li>
<li><p><code>alpha</code>: The opacity of the <strong>line</strong> and <strong>ribbon</strong> sub-geometries.</p></li>
<li><p><code>fill_ramp</code>: A secondary scale that modifies the <code>fill</code>
scale to "ramp" to another color. See <code><a href="scale_colour_ramp.html">scale_fill_ramp()</a></code> for examples.</p></li>
</ul><p><strong>Line aesthetics</strong></p>
<ul><li><p><code>linewidth</code>: Width of <strong>line</strong>. In <span class="pkg">ggplot2</span> &lt; 3.4, was called <code>size</code>.</p></li>
<li><p><code>linetype</code>: Type of <strong>line</strong> (e.g., <code>"solid"</code>, <code>"dashed"</code>, etc)</p></li>
</ul><p><strong>Other aesthetics</strong> (these work as in standard <code>geom</code>s)</p>
<ul><li><p><code>group</code></p></li>
</ul><p>See examples of some of these aesthetics in action in <code><a href="../articles/lineribbon.html">vignette("lineribbon")</a></code>.
Learn more about the sub-geom override aesthetics (like <code>interval_color</code>) in the
<a href="sub-geometry-scales.html">scales</a> documentation. Learn more about basic ggplot aesthetics in
<code><a href="https://ggplot2.tidyverse.org/articles/ggplot2-specs.html" class="external-link">vignette("ggplot2-specs")</a></code>.</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>See <code><a href="geom_lineribbon.html">geom_lineribbon()</a></code> for the geom underlying this stat.</p>
<p>Other lineribbon stats: 
<code><a href="stat_ribbon.html">stat_ribbon</a>()</code></p></div>
    </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://dplyr.tidyverse.org" class="external-link">dplyr</a></span><span class="op">)</span></span></span>
<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://ggplot2.tidyverse.org" class="external-link">ggplot2</a></span><span class="op">)</span></span></span>
<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://pkg.mitchelloharawild.com/distributional/" class="external-link">distributional</a></span><span class="op">)</span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="fu"><a href="https://ggplot2.tidyverse.org/reference/theme_get.html" class="external-link">theme_set</a></span><span class="op">(</span><span class="fu"><a href="theme_ggdist.html">theme_ggdist</a></span><span class="op">(</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># ON SAMPLE DATA</span></span></span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/base/Random.html" class="external-link">set.seed</a></span><span class="op">(</span><span class="fl">12345</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="fu"><a href="https://tibble.tidyverse.org/reference/tibble.html" class="external-link">tibble</a></span><span class="op">(</span></span></span>
<span class="r-in"><span>  x <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/rep.html" class="external-link">rep</a></span><span class="op">(</span><span class="fl">1</span><span class="op">:</span><span class="fl">10</span>, <span class="fl">100</span><span class="op">)</span>,</span></span>
<span class="r-in"><span>  y <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/stats/Normal.html" class="external-link">rnorm</a></span><span class="op">(</span><span class="fl">1000</span>, <span class="va">x</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="op">)</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%&gt;%</a></span></span></span>
<span class="r-in"><span>  <span class="fu"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html" class="external-link">ggplot</a></span><span class="op">(</span><span class="fu"><a href="https://ggplot2.tidyverse.org/reference/aes.html" class="external-link">aes</a></span><span class="op">(</span>x <span class="op">=</span> <span class="va">x</span>, y <span class="op">=</span> <span class="va">y</span><span class="op">)</span><span class="op">)</span> <span class="op">+</span></span></span>
<span class="r-in"><span>  <span class="fu">stat_lineribbon</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://ggplot2.tidyverse.org/reference/scale_brewer.html" class="external-link">scale_fill_brewer</a></span><span class="op">(</span><span class="op">)</span></span></span>
<span class="r-plt img"><img src="stat_lineribbon-1.png" alt="" width="700" height="433"></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># ON ANALYTICAL DISTRIBUTIONS</span></span></span>
<span class="r-in"><span><span class="co"># Vectorized distribution types, like distributional::dist_normal()</span></span></span>
<span class="r-in"><span><span class="co"># and posterior::rvar(), can be used with the `xdist` / `ydist` aesthetics</span></span></span>
<span class="r-in"><span><span class="fu"><a href="https://tibble.tidyverse.org/reference/tibble.html" class="external-link">tibble</a></span><span class="op">(</span></span></span>
<span class="r-in"><span>  x <span class="op">=</span> <span class="fl">1</span><span class="op">:</span><span class="fl">10</span>,</span></span>
<span class="r-in"><span>  sd <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/seq.html" class="external-link">seq</a></span><span class="op">(</span><span class="fl">1</span>, <span class="fl">3</span>, length.out <span class="op">=</span> <span class="fl">10</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="op">)</span> <span class="op"><a href="https://magrittr.tidyverse.org/reference/pipe.html" class="external-link">%&gt;%</a></span></span></span>
<span class="r-in"><span>  <span class="fu"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html" class="external-link">ggplot</a></span><span class="op">(</span><span class="fu"><a href="https://ggplot2.tidyverse.org/reference/aes.html" class="external-link">aes</a></span><span class="op">(</span>x <span class="op">=</span> <span class="va">x</span>, ydist <span class="op">=</span> <span class="fu"><a href="https://pkg.mitchelloharawild.com/distributional/reference/dist_normal.html" class="external-link">dist_normal</a></span><span class="op">(</span><span class="va">x</span>, <span class="va">sd</span><span class="op">)</span><span class="op">)</span><span class="op">)</span> <span class="op">+</span></span></span>
<span class="r-in"><span>  <span class="fu">stat_lineribbon</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://ggplot2.tidyverse.org/reference/scale_brewer.html" class="external-link">scale_fill_brewer</a></span><span class="op">(</span><span class="op">)</span></span></span>
<span class="r-plt img"><img src="stat_lineribbon-2.png" alt="" width="700" height="433"></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="https://www.mjskay.com" class="external-link">Matthew Kay</a>.</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>

