Open rsh52 opened 3 months ago
As an update, it is possible to combine Geom types and we have been successful in following similar examples to the ggplot2 text, however it has proven difficult to capture this data in the legend which is likely a non-starter for implementation.
Feature Request Description
It would be nice to display markers offset from the lanes, specifically in such an example as having infusion markers as downward triangles at the points of infusion just above the lane.
Ideally we would want some way to communicate from the segment layer what the
linewidth
value is for the offset of the following point layer. The problem is layers are stateless and isolated from each other, and the declaration oflinewidth
is based on plot space whereas the actual positioning is based on pixel space as orchestrated by the grid object calculation.Proposed Solution
There are a few avenues to pursue but each is a bit tricky.
Option 1
Add a secondary
GeomPoint
to agridList()
inGeomSwimLane
. This would require thinking of a way to reshape how data gets fed togeom_swim_lane()
and passed to the second grid object.This is a bit undesirable because reshaping the data would likely get messy and nonstandard.
Option 2
Figure out a way to capture the linewidth grob value from
GeomSwimLane
viaThe issue here is this never gets triggered until the plot is printed.
GeomSwimLane
is also stateless, so values internal to this likely can't be sent outward to the next layer.Option 3
Develop an external function that gets called after the applicable point and lane layers. This is described in a convo with ggplot2 devs on SO here : https://stackoverflow.com/questions/78330694/ggplot2-position-nudge-respective-of-linewidth
The problem here is that it's hard to control how users will layer and call these functions. It's also pretty hacky and likely to fail in a production setting.
Additional Context
Add any other context or screenshots about the feature request here.
Checklist