-
Notifications
You must be signed in to change notification settings - Fork 2.1k
theme docs - strip.text.x.* family #5062
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
Conversation
Thanks for catching! Looks good, but could you exclude the update on the snapshot? I think it's unnecessary. |
Please check out that after revert to the old snap svg file the test are failing, for most systems. |
This reverts commit acf5078.
Hmm, so does it mean this change actually affects the behaviour of ggplot2? Sorry, then the things are a bit complex than I expected. We have to figure out what's happening here... |
I will investigate it. Summary for current situation and the source of the test error. ggplot2/tests/testthat/test-facet-strips.r Lines 164 to 168 in fc191a0
The difference in svg is the same in two places |
So I fixed another problem as new theme arguments was expected but not taken into account. Line 321 in fc191a0
from that place we ended in Lines 503 to 534 in 63125db
and later could not be used e.g. here Lines 394 to 440 in fc191a0
|
More precise proof. debug(ggplot2:::calc_element)
p <- ggplot(mtcars, aes(disp, drat)) + geom_point()
p + facet_grid(am ~ cyl, switch = "both")
# in debug mode
theme[["strip.text.y.left"]]
# It is a list , previously (before PR) it was a NULL |
The suspicious thing about the visual test, is that the text is rotated by -90 degrees instead of typical 90 (only for library(ggplot2) # CRAN version
p <- ggplot(mtcars, aes(disp, drat)) + geom_point() + theme_test() +
facet_grid(am ~ cyl, switch = "both")
b <- ggplot_build(p)
old <- calc_element("strip.text.y.left", ggplot2:::plot_theme(b$plot)) Likewise with a small edit to mimic this PR: devtools::load_all("~/packages/ggplot2/") # mimicks this PR
#> ℹ Loading ggplot2
p <- ggplot(mtcars, aes(disp, drat)) + geom_point() + theme_test() +
facet_grid(am ~ cyl, switch = "both")
b <- ggplot_build(p)
new <- calc_element("strip.text.y.left", ggplot2:::plot_theme(b$plot)) The difference is in the angles: waldo::compare(old, new)
#> `old$angle`: 90
#> `new$angle`: -90 Created on 2022-11-30 by the reprex package (v2.0.1) In particular, these lines give different results, as Lines 444 to 445 in 63125db
The simplest 'fix' would be to add |
Wow, thanks you two so much for investigating! The fix sounds good to me. I'll try to understated the problem. |
Sorry for the delay. I think this fix is good enough. @Polkas Line 621 in 5ebe979
|
@yutannihilation, thanks for a clear recommendation. I just applied it, and the _snaps for a few plots have to be updated. |
Thanks, but I think the change is not what @teunbrand and I recommended...? The suggestion was to add |
I understand that Ps. I learned a new thing that git can overwrite chmod of the file (false positive), I had to fix it manually for one file here with |
I guess you mistakenly committed |
I created another issue connected with the arm64 #5110. I will remove these files. |
Oh, curious. Anyway, this pull request looks perfect now. Thanks! |
closes #5054