ggdist
ggdist copied to clipboard
Layer wrapper that allows arbitrary geometries to be used with the thickness aesthetic
Might be nice to allow arbitrary geometries to be used with the thickness aesthetic... probably something that wraps the layers and applies the thickness scaling to thickness values and then adds them to x or y as appropriate....
- would only work with
scale_thickness_shared() - would need some way to specify which aesthetics to add the thickness to --- maybe if
thicknessvalues are scaled relative to0this would just be solved by something likeafter_scale(y = y + thickness)? Not sure ifjustificationandsidewould work correctly in this case though. So might need to just pass a set of aesthetics to add the thickness to. - would ideally handle
sideandjustification - ideally something like
with_thickness(geom_text(aes(xdist = d, y = some_factor, thickness = density(d, Mode(d))), label = "mode"))would work, though it might be hard to get there.
There's also a small set of geoms in addition to geom_spike that might be useful to have explicitly:
- a horizontal line from the axis to a thickness value
- a text label at a thickness value
- a horizontal line between two equal thickness values (harder; simpler might be a line between two thickness values)