-
Notifications
You must be signed in to change notification settings - Fork 65
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
Ability to add more layers to the ggplot output #5
base: master
Are you sure you want to change the base?
Conversation
… errors downstream
Thanks for this thoughtful pull request! I'll set up some tests and check if everything works smoothly with different parameters. However, I'll probably get back to this only at some point later in July. Just out of curiosity, when you refer to additional layers, do you have in mind something specific? If it's a reasonably common use case, I may consider facilitating this directly from the package |
I was mainly looking for a way to add points at specific places, which is why I created that In a more general sense, because I transferred the 'xend', 'yend' and 'colour' aes definitions from the main ggplot call to the geom_segment call (see 0e20208), it should now be easy to add any other layer on top of the ganttrify output (such as text, rectangles, etc) using the native ggplot2 functions and simply specifying an 'x' and 'y' aes. |
Hi!
I have played with the code a bit more, and I thought perhaps you would appreciate having a look at the changes I made. I was mainly looking for a way to be able to add points, but adding a
geom_point
call to the output of ganttrify was returning errors. I re-based my fork with the latest commits, so it should be up to date.Summary of the changes:
if (exact_date)
call in lines 62-70. I did this because it seems to me thatexact_date = TRUE
only makes sense ifuse_date = TRUE
, but I may be wrong.gantt_levels
), so the user can easily obtain a copy of the y axis order (if needed for adding layers on top of the ganttrify output).size
column in df_yearmon_fct (which is filled with the values listed in argumentssize_wp
andsize_activity
, to avoid having to call geom_segment twice in lines 157-166.gantt_points
function (needs a data frame with columnsactivity
anddate
) that can be used on top of ganttrify to add points to the plot (see example in the function documentation).Note: I am only using ganttrify with
by_date = TRUE
andexact_date = TRUE
and didn't test all options thoroughly. But I did try runninggantt_points()
on the default example code and it also worked, so it should be fine.Hope you find at least some of these relevant.