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

Common limits for both facets when using facet_share() #7

Open
thomas-neitmann opened this issue Feb 22, 2020 · 2 comments
Open

Common limits for both facets when using facet_share() #7

thomas-neitmann opened this issue Feb 22, 2020 · 2 comments
Assignees

Comments

@thomas-neitmann
Copy link

I would like to have a common limit for both facets when using facet_share(). In the example below the largest value on the left is 10 whereas it is 5 on the right. Because the limits are not the same, it looks as though the values are equal.

library(ggplot2)
sex <- rep(c("male", "female"), each = 5)
cat <- rep(LETTERS[1:5], 2)
val <- c(1:5, -(6:10))
df <- tibble::tibble(sex, cat, val)

p <- ggplot(df, aes(cat, val, fill = sex)) +
  geom_col() +
  ggpol::facet_share(vars(sex), scales = "free", reverse_num = TRUE) + 
  coord_flip()
p

image

A naive way to set the limits failed as expected.

p + ylim(0, 10)

image

It would be great to have an option for both facets to have the same limits.

@erocoar erocoar self-assigned this Feb 26, 2020
@erocoar
Copy link
Owner

erocoar commented Feb 29, 2020

Hi, thanks for your feedback. I think that's a great idea. Unfortunately for ggpol 0.0.6 I temporarily removed facet_share, because it is incompatible with upcoming changes both in grid and ggplot2. The rewrite will take some time - but I hope to have more news soon

@ReichYang
Copy link

Hi. I'm using ggpol for the population pyramid and faced the same problem. Are there any updates or workarounds on this? @erocoar

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

3 participants