ggdist 3.2.0
New features and enhancements:
- Several computed variables in
stat_slabinterval()
can now be shared across
sub-geometries:- The
.width
andlevel
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 usingcut_cdf_qi()
to create densities
filled according to a set of intervals (this approach which also works on
highest-density intervals, whichcut_cdf_qi()
does not). Examples in
vignette("slabinterval")
have been updated to use the new approach, and
an example has been added tovignette("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)
,
thepdf
andcdf
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
, andcdf_max
also give the PDF and CDF at the lower
and upper ends of the interval. An example invignette("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).
- The
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 invignette("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 theorder
aesthetic. This makes it possible to create
"stacked" dotplots by mapping a discrete variable onto theorder
aesthetic
(#132). As part of this change,bin_dots()
now maintains the original data
order within bins whenlayout = "bin"
. See an example in
vignette("dotsinterval")
. - A new
verbose = TRUE
flag ingeom_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 usescale
,
and if you want to provide constraints on the bin width, you can pass a
2-vector tobinwidth
. - The
expand
argument instat_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 thefamily
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 onggplot2::guide_colorbar()
.
See an example invignette("lineribbon")
.
Bug fixes:
- If there are
NA
s in thethickness
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).