Skip to content
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

[bug?] nestline is element_blank by default #89

Closed
pank opened this issue Jan 31, 2023 · 2 comments
Closed

[bug?] nestline is element_blank by default #89

pank opened this issue Jan 31, 2023 · 2 comments

Comments

@pank
Copy link

pank commented Jan 31, 2023

Hi,

Perhaps I am misunderstanding the docs, but wouldn't it make more sense if the nest_line argument of facet_nested would inherit directly from the theme instead of being element_blank (formals(facet_nested)$nest_line => element_blank())?
Then the default theme value could be set to element_blank().

In particular, I would have thought that g1 and g2 would be identical in the below example:

library(ggh4x)
library(patchwork)
d <- data.frame(x = 1:10,
                y = 1:10,
                outer = rep(LETTERS[1:3],  each=3,  length.out = 10),
                inner = rep(letters[4:5],  each=7, length.out = 10))

g1 <- ggplot(d, aes(x, y)) + geom_point() +
    facet_nested(outer+inner ~ ., nest_line = element_line())
g2 <- ggplot(d, aes(x, y)) + geom_point() +
    facet_nested(outer+inner ~ .) +
    theme(ggh4x.facet.nestline = element_line())
g1 + g2

Uploading images isn't working for me atm, but I would have thought both g1 and g2 would have nestlines, but they are only shown in g1.

@teunbrand
Copy link
Owner

I agree that this is awkward and could be improved, but I don't know when I'll have time to get around to this though.

@teunbrand
Copy link
Owner

This should now work as intended in the dev version:

library(ggh4x)
#> Loading required package: ggplot2
#> Warning: package 'ggplot2' was built under R version 4.1.3
library(patchwork)
d <- data.frame(x = 1:10,
                y = 1:10,
                outer = rep(LETTERS[1:3],  each=3,  length.out = 10),
                inner = rep(letters[4:5],  each=7, length.out = 10))

g1 <- ggplot(d, aes(x, y)) + geom_point() +
  facet_nested(outer+inner ~ ., nest_line = element_line())
g2 <- ggplot(d, aes(x, y)) + geom_point() +
  facet_nested(outer+inner ~ .) +
  theme(ggh4x.facet.nestline = element_line())
g1 + g2

Created on 2023-07-14 by the reprex package (v2.0.1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants