Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Offset Indicators for Segments #45

Open
5 tasks done
rsh52 opened this issue May 29, 2024 · 1 comment
Open
5 tasks done

[FEATURE] Offset Indicators for Segments #45

rsh52 opened this issue May 29, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@rsh52
Copy link
Contributor

rsh52 commented May 29, 2024

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 of linewidth 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 a gridList() in GeomSwimLane. This would require thinking of a way to reshape how data gets fed to geom_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 via

GeomSegment$draw_panel(data, panel_params, coord,
        arrow = NULL, arrow.fill = NULL,
        lineend = "butt", linejoin = "round", na.rm = FALSE
      )$gp$lwd[[1]]

The 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

  • The issue is atomic
  • The issue description is documented
  • The issue title describes the problem succinctly
  • Developers are assigned to the issue
  • Labels are assigned to the issue
@rsh52 rsh52 added the enhancement New feature or request label May 29, 2024
@rsh52 rsh52 self-assigned this May 29, 2024
@rsh52 rsh52 mentioned this issue Jun 14, 2024
2 tasks
@rsh52
Copy link
Contributor Author

rsh52 commented Jul 12, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant