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
{{ message }}
Repository navigation
Natively Cap the Axis Lines, as featured on the lemon package (feature) #4907
---- Feature Request: Natively Cap the Axis Lines ----
It would be amazing to have the option to cap the axis lines, such as featured on the lemon package. The lemon package, however, requires to remove the ggplot2 default axis lines so that new ones can be drawn:
In order to manipulate the axis lines, they must be drawn. Modify the theme so the panel.border is not drawn (it will be on top of the axis lines), and have the axis lines drawn.
Therefore, it would be nice being able to cap the axis lines natively (without getting rid of the original axis lines).
Please find below a reprex of an example chart with capped axis lines:
Does it make sense to introduce an entire separate axis guide for this purpose? Isn't the only difference to the regular guides that the axis line gets truncated? If I'm seeing this correctly, I'd suggest to implement only one guide function and make the axis line truncation just an argument of that guide.
That would work too. Also in that case, what should the argument name be?
What values should it accept? A simple truncate = TRUE/FALSE to let the line start and end at the most extreme ticks? Or something more flexible, like functions that operate on {breaks/limits} or could we supply data-values directly (or both)?
I would suggest to implement it first and then think about this. It's not immediately clear to me that anything other than TRUE/FALSE is needed, but sometimes alternative options reveal themselves once you actually have working code.
I know this is merged, but I wanted to point out that the option to switch guides from complete to truncated should be supported as a theme element / option as well. I have been waiting for this feature and have used various workarounds, but I realized recently working on a large project where I needed to change a lot of aesthetics across a large number of plots, the ability to reformat as much as possible via theme application is very useful. I hope that the default guide could be complete, specified in the theme, with the option to truncate being available as a guide option or by changing the theme default.
Activity
thomasp85 commentedon Jul 26, 2022
I'll be sounding like a broken record, but once guides have been rewritten we will certainly look into something like this
teunbrand commentedon Jul 26, 2022
I've written something similar before, so it wouldn't be much of a bother to slap onto #4879 if the ggplot team agrees.
thomasp85 commentedon Jul 26, 2022
absolutely - I've been wanting to make something like this forever. I just think it makes most sense after you've rewritten the guide system 😉
teunbrand commentedon Feb 21, 2023
So, for the difficult bit: what should be the name of this axis guide?
Here is an incomplete list of suggestions:
guide_axis_float()guide_axis_hover()guide_axis_cap()/guide_axis_capped()guide_axis_trunc()/guide_axis_truncated()guide_axis_resect()guide_axis_short()clauswilke commentedon Feb 21, 2023
Does it make sense to introduce an entire separate axis guide for this purpose? Isn't the only difference to the regular guides that the axis line gets truncated? If I'm seeing this correctly, I'd suggest to implement only one guide function and make the axis line truncation just an argument of that guide.
teunbrand commentedon Feb 21, 2023
That would work too. Also in that case, what should the argument name be?
What values should it accept? A simple
truncate = TRUE/FALSEto let the line start and end at the most extreme ticks? Or something more flexible, like functions that operate on {breaks/limits} or could we supply data-values directly (or both)?clauswilke commentedon Feb 21, 2023
I would suggest to implement it first and then think about this. It's not immediately clear to me that anything other than
TRUE/FALSEis needed, but sometimes alternative options reveal themselves once you actually have working code.eejd commentedon Jul 30, 2024
I know this is merged, but I wanted to point out that the option to switch guides from complete to truncated should be supported as a theme element / option as well. I have been waiting for this feature and have used various workarounds, but I realized recently working on a large project where I needed to change a lot of aesthetics across a large number of plots, the ability to reformat as much as possible via theme application is very useful. I hope that the default guide could be complete, specified in the theme, with the option to truncate being available as a guide option or by changing the theme default.