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
theme_set() breaks theme_void() if axis.text.x or axis.text.y is modified #2058
Hi, I'm having trouble with one of my custom themes since a recent update (I have tried with version 2.2.1 and the current snapshot from this repository). When I change the settings of axis.text.x or axis.text.y in a theme that is set as default using theme_set(), theme_void() throws an error. This causes trouble when I try to use cowplot::plot_grid() (see my previous bug report).
I don't really think this is a bug - you need to specify the angle the text should be written in. Usually this is derived from the root text element but since this is element_blank in theme_void() you'll need to specify it when you modify child elements...
What is very surprising to me is that I don't make any changes to theme_void(). I modify theme_classic() and set that modified version as default. Still this causes problems with theme_void(). I came across this behavior working with a custom theme of my own where I modify axis text margins. I don't make any changes to the angle and I don't touch theme_void().
Moreover, if I nevertheless set angle to any value, I get the following error
Error in if (debug) { : Argument has length 0
which is why in my continued example I also set debug = FALSE.
Also, I played a little more with this and when I make changes to, e.g., axis.title.x I get the same angle-error, but when I do set angle explicitly I get a new error:
I've run into this a couple of times and wind up back on this issue each time. The thing I keep forgetting is that this does not cause an issue if simply axis.title() is set. It only seems to come into play (for me) when I'm trying to set axis.title.x() or axis.title.y() explicitly. With that in mind, I've been able to find various workarounds.
Activity
thomasp85 commentedon Feb 28, 2017
I don't really think this is a bug - you need to specify the angle the text should be written in. Usually this is derived from the root text element but since this is
element_blankintheme_void()you'll need to specify it when you modify child elements...crsh commentedon Feb 28, 2017
What is very surprising to me is that I don't make any changes to
theme_void(). I modifytheme_classic()and set that modified version as default. Still this causes problems withtheme_void(). I came across this behavior working with a custom theme of my own where I modify axis text margins. I don't make any changes to the angle and I don't touchtheme_void().Moreover, if I nevertheless set
angleto any value, I get the following errorwhich is why in my continued example I also set
debug = FALSE.Also, I played a little more with this and when I make changes to, e.g.,
axis.title.xI get the same angle-error, but when I do setangleexplicitly I get a new error:has2k1 commentedon Feb 28, 2017
I think it is a bug.
theme_void()is acompletetheme so whatever the default theme (the one set withtheme_set) is should not affect it.thomasp85 commentedon Feb 28, 2017
Yeah, I can see that now. I'll look into it
Fix calculation of theme defaults
Fix calculation of theme defaults
Fix calculation of theme defaults
Fix calculation of theme defaults
gilliganondata commentedon Sep 15, 2017
I've run into this a couple of times and wind up back on this issue each time. The thing I keep forgetting is that this does not cause an issue if simply
axis.title()is set. It only seems to come into play (for me) when I'm trying to setaxis.title.x()oraxis.title.y()explicitly. With that in mind, I've been able to find various workarounds.crsh commentedon Nov 13, 2017
Hooray for the fix. Thanks!
Ensure complete themes never inherit defaults