You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a perfect world, the order of geom_swim_label() / geom_swim_point() wouldn't matter and the legend would render either way they are called.
Current Behavior
Due to geom_swim_label()s use of guides() to force emojis where glyphs typically reside, ordering does matter. For the time being, this is low priority and may not be addressed with the current setup of ggplot and ggnewscale.
Here is an example of two working ggswim setups:
# swim point call before label callpatient_data|>
ggplot() +
geom_swim_point(data=infusion_events,
mapping= aes(x=time_from_initial_infusion, y=pt_id, colour=infusion_type)) +
geom_swim_label(data=end_study_events,
mapping= aes(x=time_from_initial_infusion, y=pt_id,
label_vals=end_study_label, label_names=end_study_name))
# swim label before point with new_scale_color()patient_data|>
ggplot() +
geom_swim_label(data=end_study_events,
mapping= aes(x=time_from_initial_infusion, y=pt_id,
label_vals=end_study_label, label_names=end_study_name),
label.size=NA, fill=NA, size=5) +
new_scale_color() +
geom_swim_point(data=infusion_events,
mapping= aes(x=time_from_initial_infusion, y=pt_id, colour=infusion_type))
How to Reproduce the Bug:
And here is one that fails, where geom_swim_label() is called before geom_swim_point() and without new_scale_color():
In commit ec13553 we reintroduced try_ggswim() which will detect this type of error and return it with slightly more context and suggestion of how to fix it.
Failure Logs
The typical error without try_ggswim():
Error:
✖ `[[<-.data.frame`(`*tmp*`, i, value = list(end_study_label = c("✅", "❌", "⚠️"))) replacement has 3 rows, data has 5
Expected Behavior
In a perfect world, the order of
geom_swim_label()
/geom_swim_point()
wouldn't matter and the legend would render either way they are called.Current Behavior
Due to
geom_swim_label()
s use ofguides()
to force emojis where glyphs typically reside, ordering does matter. For the time being, this is low priority and may not be addressed with the current setup of ggplot and ggnewscale.Here is an example of two working ggswim setups:
How to Reproduce the Bug:
And here is one that fails, where
geom_swim_label()
is called beforegeom_swim_point()
and withoutnew_scale_color()
:Current Solution
In commit ec13553 we reintroduced
try_ggswim()
which will detect this type of error and return it with slightly more context and suggestion of how to fix it.Failure Logs
The typical error without
try_ggswim()
:And the updated error with
try_ggswim()
:Update 2024-09-03:
This only seems to work for certain cases. It does not always capture or triggerFixed in recent commit.try_ggswim()
.Checklist
Before submitting this issue, please check and verify below that the submission meets the below criteria:
The text was updated successfully, but these errors were encountered: