giocomai / ganttrify

Create beautiful Gantt charts with ggplot2
https://ganttrify.europeandatajournalism.eu/
GNU General Public License v3.0
658 stars 62 forks source link

custom annotation of charts got broken in R4.4 #53

Open oleksii-nikolaienko opened 4 months ago

oleksii-nikolaienko commented 4 months ago

Hi and thanks for such an excellent package. The question I have is related to adding custom elements to the chart using annotate, geom_text or geom_segment to produce something like this:

image

This hack used to work well in R4.3 but not in R4.4, where in the latter, these custom elements cannot find their correct position on y-axis anymore:

ganttrify(project=ganttrify::test_project) + geom_text(aes(x=as.Date("2025-02-01"), y=ganttrify::test_project$activity[1], label="text")) or ganttrify(project=ganttrify::test_project) + annotate("text", x=as.Date("2025-02-01"), y=ganttrify::test_project$activity[1], label="label")

image

Is this by design or can this possibly be fixed?

oleksii-nikolaienko commented 4 months ago

Ok, sorry, I missed that there was an update of ggantrify introducing the following.

This ganttrify(project=ganttrify::test_project) + annotate("text", x=as.Date("2025-02-01"), y=paste(ganttrify::test_project$wp, ganttrify::test_project$activity, sep="_")[1], label="label") fixes custom annotations.