ggdist icon indicating copy to clipboard operation
ggdist copied to clipboard

Layer wrapper that allows arbitrary geometries to be used with the thickness aesthetic

Open mjskay opened this issue 1 year ago • 1 comments

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 thickness values are scaled relative to 0 this would just be solved by something like after_scale(y = y + thickness)? Not sure if justification and side would work correctly in this case though. So might need to just pass a set of aesthetics to add the thickness to.
  • would ideally handle side and justification
  • 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.

mjskay avatar Feb 27 '24 18:02 mjskay

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)

mjskay avatar Feb 27 '24 18:02 mjskay