Skip to content

ggdist 3.2.0

Compare
Choose a tag to compare
@mjskay mjskay released this 19 Jul 17:11
· 412 commits to master since this release

New features and enhancements:

  • Several computed variables in stat_slabinterval() can now be shared across
    sub-geometries:
    • The .width and level computed variables can now be used in slab / dots
      sub-geometries. These values correspond to the smallest interval computed
      in the interval sub-geometry containing that portion of the slab. This
      gives a more flexible alternative to using cut_cdf_qi() to create densities
      filled according to a set of intervals (this approach which also works on
      highest-density intervals, which cut_cdf_qi() does not). Examples in
      vignette("slabinterval") have been updated to use the new approach, and
      an example has been added to vignette("dotsinterval") showing how to
      color dots by intervals.
    • As an experimental feature (currently a bit fragile) enabled via
      options(ggdist.experimental.slab_data_in_intervals = TRUE),
      the pdf and cdf computed variables can now be used in interval
      sub-geometries to get the PDF and CDF at the point summary. pdf_min,
      pdf_max, cdf_min, and cdf_max also give the PDF and CDF at the lower
      and upper ends of the interval. An example in vignette("lineribbon")
      shows how to use this to make lineribbon gradients whose color approximates
      density (as opposed to the classic gradient fan chart examples already
      in that vignette, where color approximates the CDF).
  • scale_thickness_shared() is now provided to allow the thickness scale to be
    shared across geometries, making certain plot types easier to create
    (e.g. plots of prior and posterior densities together). See
    vignette("slabinterval") for an example.
  • If thickness is less than 0 it is normalized to have a minimum of zero when
    normalization is turned on; this makes it easier to use slab functions that
    go below zero. A new example in vignette("slabinterval") shows how to use
    this to create raindrop plots.
  • The stacking order of dots within bins for geom_dotsinterval(layout = "bin")
    can now be set using the order aesthetic. This makes it possible to create
    "stacked" dotplots by mapping a discrete variable onto the order aesthetic
    (#132). As part of this change, bin_dots() now maintains the original data
    order within bins when layout = "bin". See an example in
    vignette("dotsinterval").
  • A new verbose = TRUE flag in geom_dotsinterval() outputs the selected
    binwidth in both data units and normalized parent coordinates. This may be
    useful if you want to start with an automatically-selected bin width and then
    adjust it manually. Though note: if you just want to scale the selected
    bin width to fit within a desired area, it is probably better to use scale,
    and if you want to provide constraints on the bin width, you can pass a
    2-vector to binwidth.
  • The expand argument in stat_slabinterval() can now take a length-two logical
    vector to control expansion to the lower and upper limits respectively (#129).
    Thanks to @teunbrand.
  • geom_dotsinterval() now supports the family aesthetic for setting the font
    used to display its dots (based on a conversation with @gdbassett).
  • Experimental guide_rampbar() for creating gradient-like legends for
    continuous color/fill ramp scales, based on ggplot2::guide_colorbar().
    See an example in vignette("lineribbon").

Bug fixes:

  • If there are NAs in the thickness aesthetic of a slab, these are now
    rendered as gaps in the slab (#129).
  • Fixed the check for empty x/y scales to avoid extending the scale to cover 0/1
    when plotting distributional objects whose bulk lies outside that region
    (when there is nothing else on the plot).