Repository navigation
Axis caps - #5289
Axis caps#5289
Conversation
|
+1ing as a user who has been looking forward to this capability for a while :-) OTOH am I correct in thinking that, even with this PR and #4879, there still isn't a way to enable this capping behaviour globally? E.g. You still can't add guides as part of |
|
That's right, I haven't added this as a theme option, but it might be something to consider. You can of course do the following: capped_axes <- guides(
x = guide_axis(cap = "both"),
y = guide_axis(cap = "upper"),
y.sec = guide_axis(cap = "lower"),
x.sec = guide_axis(cap = "none")
)
p1 <- ggplot(...) + ... + capped_axes
P2 <- ggplot(...) + ... + capped_axes
# etc. |
|
Thanks, your suggestion is effectively what I do now (with your very nice ggh4x package). But I do think there’s additional value in make it “themeable”. Adding my support to your consideration. |
|
I think it might make more sense to fold in #4271 first before adding this as a theme setting, that way you could set default guides in the theme. |
|
SGTM, thanks Teun. |
|
I know this is merged, but I wanted to second that the option to switch guides capping 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. |
|
The way guides are implemented, that is not an easy feature to incorporate. |
This PR aims to fix #4907.
Briefly, it adds a
capargument toguide_axis()that truncates the axis line to the breaks. There are 4 different options, presented below. AlsoTRUE/FALSEare shortcuts for"both"/"none".I've thought about allowing user-defined coordinates as the capping points, either by function or input on data values, but that'd complicate the implementation quite a bit. I also thought that this is probably simple enough not to separate out to a separate guide.
Created on 2023-04-26 with reprex v2.0.2