<!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="Variant of geom_dots() for creating blurry dotplots. Accepts an sd
aesthetic that gives the standard deviation of the blur applied to the dots.
Requires a graphics engine supporting radial gradients. Unlike geom_dots(),
all dots must be circular, so this geom does not support the shape aesthetic."><title>Blurry dot plot (geom) — geom_blur_dots • 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="Blurry dot plot (geom) — geom_blur_dots"><meta property="og:description" content="Variant of geom_dots() for creating blurry dotplots. Accepts an sd
aesthetic that gives the standard deviation of the blur applied to the dots.
Requires a graphics engine supporting radial gradients. Unlike geom_dots(),
all dots must be circular, so this geom does not support the shape aesthetic."><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>Blurry dot plot (geom)</h1>
      <small class="dont-index">Source: <a href="https://github.com/mjskay/ggdist/blob/HEAD/R/geom_blur_dots.R" class="external-link"><code>R/geom_blur_dots.R</code></a></small>
      <div class="d-none name"><code>geom_blur_dots.Rd</code></div>
    </div>

    <div class="ref-description section level2">
    <p>Variant of <code><a href="geom_dots.html">geom_dots()</a></code> for creating blurry dotplots. Accepts an <code>sd</code>
aesthetic that gives the standard deviation of the blur applied to the dots.
Requires a graphics engine supporting radial gradients. Unlike <code><a href="geom_dots.html">geom_dots()</a></code>,
all dots must be circular, so this geom does not support the <code>shape</code> aesthetic.</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">geom_blur_dots</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>  stat <span class="op">=</span> <span class="st">"identity"</span>,</span>
<span>  position <span class="op">=</span> <span class="st">"identity"</span>,</span>
<span>  <span class="va">...</span>,</span>
<span>  blur <span class="op">=</span> <span class="st">"gaussian"</span>,</span>
<span>  binwidth <span class="op">=</span> <span class="cn">NA</span>,</span>
<span>  dotsize <span class="op">=</span> <span class="fl">1.07</span>,</span>
<span>  stackratio <span class="op">=</span> <span class="fl">1</span>,</span>
<span>  layout <span class="op">=</span> <span class="st">"bin"</span>,</span>
<span>  overlaps <span class="op">=</span> <span class="st">"nudge"</span>,</span>
<span>  smooth <span class="op">=</span> <span class="st">"none"</span>,</span>
<span>  overflow <span class="op">=</span> <span class="st">"warn"</span>,</span>
<span>  verbose <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span>  orientation <span class="op">=</span> <span class="cn">NA</span>,</span>
<span>  subguide <span class="op">=</span> <span class="st">"none"</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>stat</dt>
<dd><p>The statistical transformation to use on the data for this
layer, either as a <code>ggproto</code> <code>Geom</code> subclass or as a string naming the
stat stripped of the <code>stat_</code> prefix (e.g. <code>"count"</code> rather than
<code>"stat_count"</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.</p></dd>


<dt>blur</dt>
<dd><p>Blur function to apply to dots.
One of:</p><ul><li><p>A function that takes a numeric vector of distances from the dot
center, the dot radius, and the standard deviation of the blur and returns
a vector of opacities in \([0, 1]\), such as <code><a href="blur.html">blur_gaussian()</a></code>
or <code><a href="blur.html">blur_interval()</a></code>.</p></li>
<li><p>A string indicating what blur function to use, as the suffix to a
function name starting with <code>blur_</code>; e.g. <code>"gaussian"</code> (the default)
applies <code><a href="blur.html">blur_gaussian()</a></code>.</p></li>
</ul></dd>


<dt>binwidth</dt>
<dd><p>The bin width to use for laying out the dots.
One of:</p><ul><li><p><code>NA</code> (the default): Dynamically select the bin width based on the
size of the plot when drawn. This will pick a <code>binwidth</code> such that the
tallest stack of dots is at most <code>scale</code> in height (ideally exactly <code>scale</code>
in height, though this is not guaranteed).</p></li>
<li><p>A length-1 (scalar) numeric or <a href="https://rdrr.io/r/grid/unit.html" class="external-link">unit</a> object giving the exact bin width.</p></li>
<li><p>A length-2 (vector) numeric or <a href="https://rdrr.io/r/grid/unit.html" class="external-link">unit</a> object giving the minimum and maximum
desired bin width. The bin width will be dynamically selected within
these bounds.</p></li>
</ul><p>If the value is numeric, it is assumed to be in units of data. The bin width
(or its bounds) can also be specified using <code><a href="https://rdrr.io/r/grid/unit.html" class="external-link">unit()</a></code>, which may be useful if
it is desired that the dots be a certain point size or a certain percentage of
the width/height of the viewport. For example, <code>unit(0.1, "npc")</code> would make
dots that are <em>exactly</em> 10% of the viewport size along whichever dimension the
dotplot is drawn; <code>unit(c(0, 0.1), "npc")</code> would make dots that are <em>at most</em>
10% of the viewport size (while still ensuring the tallest stack is less than
or equal to <code>scale</code>).</p></dd>


<dt>dotsize</dt>
<dd><p>The width of the dots relative to the <code>binwidth</code>. The default,
<code>1.07</code>, makes dots be just a bit wider than the bin width, which is a
manually-tuned parameter that tends to work well with the default circular
shape, preventing gaps between bins from appearing to be too large visually
(as might arise from dots being <em>precisely</em> the <code>binwidth</code>). If it is desired
to have dots be precisely the <code>binwidth</code>, set <code>dotsize = 1</code>.</p></dd>


<dt>stackratio</dt>
<dd><p>The distance between the center of the dots in the same
stack relative to the dot height. The default, <code>1</code>, makes dots in the same
stack just touch each other.</p></dd>


<dt>layout</dt>
<dd><p>The layout method used
for the dots:</p><ul><li><p><code>"bin"</code> (default): places dots on the off-axis at the midpoint of
their bins as in the classic Wilkinson dotplot. This maintains the
alignment of rows and columns in the dotplot. This layout is slightly
different from the classic Wilkinson algorithm in that: (1) it nudges
bins slightly to avoid overlapping bins and (2) if the input data are
symmetrical it will return a symmetrical layout.</p></li>
<li><p><code>"weave"</code>: uses the same basic binning approach of <code>"bin"</code>, but
places dots in the off-axis at their actual positions (unless
<code>overlaps = "nudge"</code>, in which case overlaps may be nudged out of the
way). This maintains the alignment of rows but does not align dots
within columns.</p></li>
<li><p><code>"hex"</code>: uses the same basic binning approach of <code>"bin"</code>, but
alternates placing dots <code>+ binwidth/4</code> or <code>- binwidth/4</code> in the
off-axis from the bin center. This allows hexagonal packing by setting
a <code>stackratio</code> less than 1 (something like <code>0.9</code> tends to work).</p></li>
<li><p><code>"swarm"</code>: uses the <code>"compactswarm"</code> layout from
<code><a href="https://rdrr.io/pkg/beeswarm/man/beeswarm.html" class="external-link">beeswarm::beeswarm()</a></code>. Does not maintain alignment of rows or columns,
but can be more compact and neat looking, especially for sample data
(as opposed to quantile dotplots of theoretical distributions, which
may look better with <code>"bin"</code>, <code>"weave"</code>, or <code>"hex"</code>).</p></li>
<li><p><code>"bar"</code>: for discrete distributions, lays out duplicate values in
rectangular bars.</p></li>
</ul></dd>


<dt>overlaps</dt>
<dd><p>How to handle overlapping dots or bins in the <code>"bin"</code>,
<code>"weave"</code>, and <code>"hex"</code> layouts (dots never overlap in the <code>"swarm"</code> or <code>"bar"</code> layouts).
For the purposes of this argument, dots are only considered to be overlapping
if they would be overlapping when <code>dotsize = 1</code> and <code>stackratio = 1</code>; i.e.
if you set those arguments to other values, overlaps may still occur.
One of:</p><ul><li><p><code>"keep"</code>: leave overlapping dots as they are. Dots may overlap
(usually only slightly) in the <code>"bin"</code>, <code>"weave"</code>, and <code>"hex"</code> layouts.</p></li>
<li><p><code>"nudge"</code>: nudge overlapping dots out of the way. Overlaps are avoided
using a constrained optimization which minimizes the squared distance of
dots to their desired positions, subject to the constraint that adjacent
dots do not overlap.</p></li>
</ul></dd>


<dt>smooth</dt>
<dd><p>Smoother to apply to dot positions.
One of:</p><ul><li><p>A function that takes a numeric vector of dot positions and returns a
smoothed version of that vector, such as <code><a href="smooth_density.html">smooth_bounded()</a></code>,
<code><a href="smooth_density.html">smooth_unbounded()</a></code>, smooth_discrete()<code>, or </code>smooth_bar()`.</p></li>
<li><p>A string indicating what smoother to use, as the suffix to a function
name starting with <code>smooth_</code>; e.g. <code>"none"</code> (the default) applies
<code><a href="smooth_none.html">smooth_none()</a></code>, which simply returns the given vector without
applying smoothing.</p></li>
</ul><p>Smoothing is most effective when the smoother is matched to the support of
the distribution; e.g. using <code>smooth_bounded(bounds = ...)</code>.</p></dd>


<dt>overflow</dt>
<dd><p>How to handle overflow of dots beyond the extent of the geom
when a minimum <code>binwidth</code> (or an exact <code>binwidth</code>) is supplied.
One of:</p><ul><li><p><code>"keep"</code>: Keep the overflow, drawing dots outside the geom bounds.</p></li>
<li><p><code>"warn"</code>: Keep the overflow, but produce a warning suggesting solutions,
such as setting <code>binwidth = NA</code> or <code>overflow = "compress"</code>.</p></li>
<li><p><code>"compress"</code>: Compress the layout. Reduces the <code>binwidth</code> to the size necessary
to keep the dots within bounds, then adjusts <code>stackratio</code> and <code>dotsize</code> so that
the apparent dot size is the user-specified minimum <code>binwidth</code> times the
user-specified <code>dotsize</code>.</p></li>
</ul><p>If you find the default layout has dots that are too small, and you are okay
with dots overlapping, consider setting <code>overflow = "compress"</code> and supplying
an exact or minimum dot size using <code>binwidth</code>.</p></dd>


<dt>verbose</dt>
<dd><p>If <code>TRUE</code>, print out the bin width of the dotplot. Can be useful
if you want to start from an automatically-selected bin width and then adjust it
manually. Bin width is printed both as data units and as normalized parent
coordinates or <code>"npc"</code>s (see <code><a href="https://rdrr.io/r/grid/unit.html" class="external-link">unit()</a></code>). Note that if you just want to scale the
selected bin width to fit within a desired area, it is probably easier to use
<code>scale</code> than to copy and scale <code>binwidth</code> manually, and if you just want to
provide constraints on the bin width, you can pass a length-2 vector to <code>binwidth</code>.</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>subguide</dt>
<dd><p>Sub-guide used to annotate the <code>thickness</code> scale. One of:</p><ul><li><p>A function that takes a <code>scale</code> argument giving a <a href="https://ggplot2.tidyverse.org/reference/ggplot2-ggproto.html" class="external-link">ggplot2::Scale</a>
object and an <code>orientation</code> argument giving the orientation of the
geometry and then returns a <a href="https://rdrr.io/r/grid/grid-defunct.html" class="external-link">grid::grob</a> that will draw the axis
annotation, such as <code><a href="subguide_axis.html">subguide_axis()</a></code> (to draw a traditional axis) or
<code><a href="subguide_none.html">subguide_none()</a></code> (to draw no annotation). See <code><a href="subguide_axis.html">subguide_axis()</a></code>
for a list of possibilities and examples.</p></li>
<li><p>A string giving the name of such a function when prefixed
with <code>"subguide"</code>; e.g. <code>"axis"</code> or <code>"none"</code>.</p></li>
</ul></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>logical. 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.
It can also be a named logical vector to finely select the aesthetics to
display.</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::Geom</a> representing a blurry dot 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>The <em>dots</em> family of stats and geoms are similar to <code><a href="https://ggplot2.tidyverse.org/reference/geom_dotplot.html" class="external-link">geom_dotplot()</a></code> but with a number of differences:</p>
<ul><li><p>Dots geoms act like slabs in <code><a href="geom_slabinterval.html">geom_slabinterval()</a></code> and can be given x positions (or y positions when
in a horizontal orientation).</p></li>
<li><p>Given the available space to lay out dots, the dots geoms will automatically determine how many bins to
use to fit the available space.</p></li>
<li><p>Dots geoms use a dynamic layout algorithm that lays out dots from the center out if the input data are
symmetrical, guaranteeing that symmetrical data results in a symmetrical plot. The layout algorithm also prevents
dots from overlapping each other.</p></li>
<li><p>The shape of the dots in these geoms can be changed using the <code>slab_shape</code> aesthetic (when using the
<code>dotsinterval</code> family) or the <code>shape</code> or <code>slab_shape</code> aesthetic (when using the <code>dots</code> family)</p></li>
</ul><p>Stats and geoms in this family include:</p><ul><li><p><code><a href="geom_dots.html">geom_dots()</a></code>: dotplots on raw data. Ensures the dotplot fits within available space by reducing the size
of the dots automatically (may result in very small dots).</p></li>
<li><p><code><a href="geom_swarm.html">geom_swarm()</a></code> and <code><a href="geom_weave.html">geom_weave()</a></code>: dotplots on raw data with defaults intended to create "beeswarm" plots.
Used <code>side = "both"</code> by default, and sets the default dot size to the same size as <code><a href="https://ggplot2.tidyverse.org/reference/geom_point.html" class="external-link">geom_point()</a></code>
(<code>binwidth = unit(1.5, "mm")</code>), allowing dots to overlap instead of getting very small.</p></li>
<li><p><code><a href="stat_dots.html">stat_dots()</a></code>: dotplots on raw data, <span class="pkg">distributional</span> objects, and <code><a href="https://mc-stan.org/posterior/reference/rvar.html" class="external-link">posterior::rvar()</a></code>s</p></li>
<li><p><code><a href="geom_dotsinterval.html">geom_dotsinterval()</a></code>: dotplot + interval plots on raw data with already-calculated
intervals (rarely useful directly).</p></li>
<li><p><code><a href="stat_dotsinterval.html">stat_dotsinterval()</a></code>: dotplot + interval plots on raw data, <span class="pkg">distributional</span> objects,
and <code><a href="https://mc-stan.org/posterior/reference/rvar.html" class="external-link">posterior::rvar()</a></code>s (will calculate intervals for you).</p></li>
<li><p><code>geom_blur_dots()</code>: blurry dotplots that allow the standard deviation of a blur applied to
each dot to be specified using the <code>sd</code> aesthetic.</p></li>
<li><p><code><a href="stat_mcse_dots.html">stat_mcse_dots()</a></code>: blurry dotplots of quantiles using the Monte Carlo Standard Error of each quantile.</p></li>
</ul><p><code><a href="stat_dots.html">stat_dots()</a></code> and <code><a href="stat_dotsinterval.html">stat_dotsinterval()</a></code>, when used with the <code>quantiles</code> argument,
are particularly useful for constructing quantile dotplots, which can be an effective way to communicate uncertainty
using a frequency framing that may be easier for laypeople to understand (Kay et al. 2016, Fernandes et al. 2018).</p>
    </div>
    <div class="section level2">
    <h2 id="aesthetics">Aesthetics<a class="anchor" aria-label="anchor" href="#aesthetics"></a></h2>
    

<p>The dots+interval <code>stat</code>s and <code>geom</code>s have a wide variety of aesthetics that control
the appearance of their three sub-geometries: the <strong>dots</strong> (aka the <strong>slab</strong>), the
<strong>point</strong>, and the <strong>interval</strong>.</p>
<p><strong>Positional aesthetics</strong></p>
<ul><li><p><code>x</code>: x position of the geometry</p></li>
<li><p><code>y</code>: y position of the geometry</p></li>
</ul><p><strong>Dots-specific (aka Slab-specific) aesthetics</strong></p>
<ul><li><p><code>sd</code>: The standard deviation (in data units) of the blur associated with each dot.</p></li>
<li><p><code>order</code>: The order in which data points are stacked within bins. Can be used to create the effect of
"stacked" dots by ordering dots according to a discrete variable. If omitted (<code>NULL</code>), the
value of the data points themselves are used to determine stacking order. Only applies when
<code>layout</code> is <code>"bin"</code> or <code>"hex"</code>, as the other layout methods fully determine both <em>x</em> and <em>y</em> positions.</p></li>
<li><p><code>side</code>: Which side to place the slab on. <code>"topright"</code>, <code>"top"</code>, and <code>"right"</code> are synonyms
which cause the slab to be drawn on the top or the right depending on if <code>orientation</code> is <code>"horizontal"</code>
or <code>"vertical"</code>. <code>"bottomleft"</code>, <code>"bottom"</code>, and <code>"left"</code> are synonyms which cause the slab
to be drawn on the bottom or the left depending on if <code>orientation</code> is <code>"horizontal"</code> or
<code>"vertical"</code>. <code>"topleft"</code> causes the slab to be drawn on the top or the left, and <code>"bottomright"</code>
causes the slab to be drawn on the bottom or the right. <code>"both"</code> draws the slab mirrored on both
sides (as in a violin plot).</p></li>
<li><p><code>scale</code>: What proportion of the region allocated to this geom to use to draw the slab. If <code>scale = 1</code>,
slabs that use the maximum range will just touch each other. Default is <code>0.9</code> to leave some space
between adjacent slabs. For a comprehensive discussion and examples of slab scaling and normalization,
see the <a href="https://mjskay.github.io/ggdist/articles/thickness.html" class="external-link"><code>thickness</code> scale article</a>.</p></li>
<li><p><code>justification</code>: Justification of the interval relative to the slab, where <code>0</code> indicates bottom/left
justification and <code>1</code> indicates top/right justification (depending on <code>orientation</code>). If <code>justification</code>
is <code>NULL</code> (the default), then it is set automatically based on the value of <code>side</code>: when <code>side</code> is
<code>"top"</code>/<code>"right"</code> <code>justification</code> is set to <code>0</code>, when <code>side</code> is <code>"bottom"</code>/<code>"left"</code>
<code>justification</code> is set to <code>1</code>, and when <code>side</code> is <code>"both"</code> <code>justification</code> is set to 0.5.</p></li>
<li><p><code>datatype</code>: When using composite geoms directly without a <code>stat</code> (e.g. <code><a href="geom_slabinterval.html">geom_slabinterval()</a></code>), <code>datatype</code> is used to
indicate which part of the geom a row in the data targets: rows with <code>datatype = "slab"</code> target the
slab portion of the geometry and rows with <code>datatype = "interval"</code> target the interval portion of
the geometry. This is set automatically when using ggdist <code>stat</code>s.</p></li>
</ul><p><strong>Interval-specific aesthetics</strong></p>
<ul><li><p><code>xmin</code>: Left end of the interval sub-geometry (if <code>orientation = "horizontal"</code>).</p></li>
<li><p><code>xmax</code>: Right end of the interval sub-geometry (if <code>orientation = "horizontal"</code>).</p></li>
<li><p><code>ymin</code>: Lower end of the interval sub-geometry (if <code>orientation = "vertical"</code>).</p></li>
<li><p><code>ymax</code>: Upper end of the interval sub-geometry (if <code>orientation = "vertical"</code>).</p></li>
</ul><p><strong>Color aesthetics</strong></p>
<ul><li><p><code>colour</code>: (or <code>color</code>) The color of the <strong>interval</strong> and <strong>point</strong> sub-geometries.
Use the <code>slab_color</code>, <code>interval_color</code>, or <code>point_color</code> aesthetics (below) to
set sub-geometry colors separately.</p></li>
<li><p><code>fill</code>: The fill color of the <strong>slab</strong> and <strong>point</strong> sub-geometries. Use the <code>slab_fill</code>
or <code>point_fill</code> aesthetics (below) to set sub-geometry colors separately.</p></li>
<li><p><code>alpha</code>: The opacity of the <strong>slab</strong>, <strong>interval</strong>, and <strong>point</strong> sub-geometries. Use the <code>slab_alpha</code>,
<code>interval_alpha</code>, or <code>point_alpha</code> aesthetics (below) to set sub-geometry colors separately.</p></li>
<li><p><code>colour_ramp</code>: (or <code>color_ramp</code>) A secondary scale that modifies the <code>color</code>
scale to "ramp" to another color. See <code><a href="scale_colour_ramp.html">scale_colour_ramp()</a></code> for examples.</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 the line used to draw the <strong>interval</strong> (except with <code><a href="geom_slab.html">geom_slab()</a></code>: then
it is the width of the <strong>slab</strong>). With composite geometries including an interval and slab,
use <code>slab_linewidth</code> to set the line width of the <strong>slab</strong> (see below). For <strong>interval</strong>, raw
<code>linewidth</code> values are transformed according to the <code>interval_size_domain</code> and <code>interval_size_range</code>
parameters of the <code>geom</code> (see above).</p></li>
<li><p><code>size</code>: Determines the size of the <strong>point</strong>. If <code>linewidth</code> is not provided, <code>size</code> will
also determines the width of the line used to draw the <strong>interval</strong> (this allows line width and
point size to be modified together by setting only <code>size</code> and not <code>linewidth</code>). Raw
<code>size</code> values are transformed according to the <code>interval_size_domain</code>, <code>interval_size_range</code>,
and <code>fatten_point</code> parameters of the <code>geom</code> (see above). Use the <code>point_size</code> aesthetic
(below) to set sub-geometry size directly without applying the effects of
<code>interval_size_domain</code>, <code>interval_size_range</code>, and <code>fatten_point</code>.</p></li>
<li><p><code>stroke</code>: Width of the outline around the <strong>point</strong> sub-geometry.</p></li>
<li><p><code>linetype</code>: Type of line (e.g., <code>"solid"</code>, <code>"dashed"</code>, etc) used to draw the <strong>interval</strong>
and the outline of the <strong>slab</strong> (if it is visible). Use the <code>slab_linetype</code> or
<code>interval_linetype</code> aesthetics (below) to set sub-geometry line types separately.</p></li>
</ul><p><strong>Slab-specific color and line override aesthetics</strong></p>
<ul><li><p><code>slab_fill</code>: Override for <code>fill</code>: the fill color of the slab.</p></li>
<li><p><code>slab_colour</code>: (or <code>slab_color</code>) Override for <code>colour</code>/<code>color</code>: the outline color of the slab.</p></li>
<li><p><code>slab_alpha</code>: Override for <code>alpha</code>: the opacity of the slab.</p></li>
<li><p><code>slab_linewidth</code>: Override for <code>linwidth</code>: the width of the outline of the slab.</p></li>
<li><p><code>slab_linetype</code>: Override for <code>linetype</code>: the line type of the outline of the slab.</p></li>
<li><p><code>slab_shape</code>: Override for <code>shape</code>: the shape of the dots used to draw the dotplot slab.</p></li>
</ul><p><strong>Interval-specific color and line override aesthetics</strong></p>
<ul><li><p><code>interval_colour</code>: (or <code>interval_color</code>) Override for <code>colour</code>/<code>color</code>: the color of the interval.</p></li>
<li><p><code>interval_alpha</code>: Override for <code>alpha</code>: the opacity of the interval.</p></li>
<li><p><code>interval_linetype</code>: Override for <code>linetype</code>: the line type of the interval.</p></li>
</ul><p><strong>Point-specific color and line override aesthetics</strong></p>
<ul><li><p><code>point_fill</code>: Override for <code>fill</code>: the fill color of the point.</p></li>
<li><p><code>point_colour</code>: (or <code>point_color</code>) Override for <code>colour</code>/<code>color</code>: the outline color of the point.</p></li>
<li><p><code>point_alpha</code>: Override for <code>alpha</code>: the opacity of the point.</p></li>
<li><p><code>point_size</code>: Override for <code>size</code>: the size of the point.</p></li>
</ul><p><strong>Deprecated aesthetics</strong></p>
<ul><li><p><code>slab_size</code>: Use <code>slab_linewidth</code>.</p></li>
<li><p><code>interval_size</code>: Use <code>interval_linewidth</code>.</p></li>
</ul><p><strong>Other aesthetics</strong> (these work as in standard <code>geom</code>s)</p>
<ul><li><p><code>width</code></p></li>
<li><p><code>height</code></p></li>
<li><p><code>group</code></p></li>
</ul><p>See examples of some of these aesthetics in action in <code><a href="../articles/dotsinterval.html">vignette("dotsinterval")</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="references">References<a class="anchor" aria-label="anchor" href="#references"></a></h2>
    <p>Kay, M., Kola, T., Hullman, J. R., &amp; Munson, S. A. (2016). When (ish) is My Bus? User-centered Visualizations
of Uncertainty in Everyday, Mobile Predictive Systems. <em>Conference on Human Factors
in Computing Systems - CHI '16</em>, 5092--5103. <a href="https://doi.org/10.1145/2858036.2858558" class="external-link">doi:10.1145/2858036.2858558</a>
.</p>
<p>Fernandes, M., Walls, L., Munson, S., Hullman, J., &amp; Kay, M. (2018). Uncertainty Displays Using Quantile Dotplots
or CDFs Improve Transit Decision-Making. <em>Conference on Human Factors in Computing Systems - CHI '18</em>.
<a href="https://doi.org/10.1145/3173574.3173718" class="external-link">doi:10.1145/3173574.3173718</a>
.</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_dotsinterval.html">geom_dotsinterval()</a></code> for the geometry this shortcut is based on.</p>
<p>See <code><a href="../articles/dotsinterval.html">vignette("dotsinterval")</a></code> for a variety of examples of use.</p>
<p>Other dotsinterval geoms: 
<code><a href="geom_dots.html">geom_dots</a>()</code>,
<code><a href="geom_dotsinterval.html">geom_dotsinterval</a>()</code>,
<code><a href="geom_swarm.html">geom_swarm</a>()</code>,
<code><a href="geom_weave.html">geom_weave</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></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="fu"><a href="https://rdrr.io/r/base/Random.html" class="external-link">set.seed</a></span><span class="op">(</span><span class="fl">1234</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">x</span> <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="op">)</span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># manually calculate quantiles and their MCSE</span></span></span>
<span class="r-in"><span><span class="co"># this could also be done more succinctly with stat_mcse_dots()</span></span></span>
<span class="r-in"><span><span class="va">p</span> <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/stats/ppoints.html" class="external-link">ppoints</a></span><span class="op">(</span><span class="fl">100</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">df</span> <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a></span><span class="op">(</span></span></span>
<span class="r-in"><span>  q <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/stats/quantile.html" class="external-link">quantile</a></span><span class="op">(</span><span class="va">x</span>, <span class="va">p</span><span class="op">)</span>,</span></span>
<span class="r-in"><span>  se <span class="op">=</span> <span class="fu">posterior</span><span class="fu">::</span><span class="fu"><a href="https://mc-stan.org/posterior/reference/mcse_quantile.html" class="external-link">mcse_quantile</a></span><span class="op">(</span><span class="va">x</span>, <span class="va">p</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>
<span class="r-in"><span><span class="va">df</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">q</span>, sd <span class="op">=</span> <span class="va">se</span><span class="op">)</span><span class="op">)</span> <span class="op">+</span></span></span>
<span class="r-in"><span>  <span class="fu">geom_blur_dots</span><span class="op">(</span><span class="op">)</span></span></span>
<span class="r-plt img"><img src="geom_blur_dots-1.png" alt="" width="700" height="433"></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="va">df</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">q</span>, sd <span class="op">=</span> <span class="va">se</span><span class="op">)</span><span class="op">)</span> <span class="op">+</span></span></span>
<span class="r-in"><span>  <span class="co"># or blur = blur_interval(.width = .95) to set the interval width</span></span></span>
<span class="r-in"><span>  <span class="fu">geom_blur_dots</span><span class="op">(</span>blur <span class="op">=</span> <span class="st">"interval"</span><span class="op">)</span></span></span>
<span class="r-plt img"><img src="geom_blur_dots-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>

