Skip to content

facet_grid() facet labels cannot be rotated when switched from right to left #3971

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

Closed
ntthung opened this issue Apr 29, 2020 · 3 comments
Closed

Comments

@ntthung
Copy link

ntthung commented Apr 29, 2020

Updated

strip.text.y.left is not documented. This issue becomes a documentation one.

Original issue raised:

When facet labels are on the right, they can be rotated:

d2 <- diamonds[sample(seq_len(nrow(diamonds)), 1000), ]
ggplot(d2) +
  geom_point(aes(carat, price)) +
  facet_grid(vars(cut), vars(color)) +
  theme(strip.text.y = element_text(angle = 0))

image

Now add switch = 'y' to facet_grid() and the facet labels are not rotated anymore.

ggplot(d2) +
  geom_point(aes(carat, price)) +
  facet_grid(vars(cut), vars(color), switch = 'y') +
  theme(strip.text.y = element_text(angle = 0))

image

If this is possible, then I can move the facet labels to the left and move the y-axis to the right. I want the facet labels to be horizontal so that they are easier to read.

@certara-smouksassi
Copy link

you need to use :
theme(strip.text.y.left = element_text(angle = 0))

@smouksassi
Copy link

duplicate of #3888

@ntthung
Copy link
Author

ntthung commented Apr 29, 2020

Thanks @certara-smouksassi . I didn't know strip.text.y.left exists; it's not in the documentation. Perhaps this issue becomes a documentation one.

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

4 participants