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

Expand documentation for coord_flip #4863

Closed
wmacnair opened this issue Jun 1, 2022 · 4 comments · Fixed by #5726
Closed

Expand documentation for coord_flip #4863

wmacnair opened this issue Jun 1, 2022 · 4 comments · Fixed by #5726

Comments

@wmacnair
Copy link

wmacnair commented Jun 1, 2022

Hello

First of all, I have used ggplot pretty much every working day for I don't know how many years now, so I should use this opportunity to say thank you for the essential package / nice community / responsive authors / all the things that make it great 🤗

In general I find the documentation of ggplot functions good, with good conceptual background and pretty thorough examples. However whenever I try to understand the tricksy bits of coord_flip, I find myself consistently frustrated by the pretty thin coverage. Questions I have wished were answered:

  • How does coord_flip interact with facets? i.e. does the facet x match to the flipped or unflipped x aes?
  • How does coord_flip interact with scales? i.e. does the scale x match to the flipped or unflipped x aes?
  • How does coord_flip interact with axis-related params in theme?
  • Do the xlim and ylim parameters in coord_flip refer to the axes before or after the flipping?
  • I'm sure there are others...

It would be great to have an expanded Details section for the coord_flip documentation, going over the concepts here. Maybe even a little diagram! It could also be an opportunity to describe some cases where coord_flip doesn't work so well, or common pitfalls.

Thanks again!
Will

@wmacnair wmacnair changed the title Expand documentation for Coord_flip Expand documentation for coord_flip Jun 1, 2022
@thomasp85
Copy link
Member

Thanks - you are right that there are a lot of questions around coord_flip() that could be answered better. One of the reasons for adding support for bidirectional gems was exactly that coord_flip() introduced these ambiguities and we generally advise to simply use the reverse mapping in the geom rather than flipping the coordinate system.

However since we still provide coord_flip() and will continue to do so for a long time we should improve the docs

@teunbrand
Copy link
Collaborator

Since we've decided to supersede coord_flip() in favour of bidirectional geoms in #5123, do you still think it is worth polishing the docs?

@slowkow
Copy link
Contributor

slowkow commented May 16, 2024

@teunbrand In ggplot2 extensions, how can a Geom "know" if the coords have been flipped with coord_flip()?

After studying the ggplot2 code, I am not seeing any way to figure this out. The reason I ask is because this is causing issues for users of ggrepel.

@slowkow
Copy link
Contributor

slowkow commented May 16, 2024

Nevermind! Sorry for the bother. As I continued to search through old ggplot2 issues, I found one that helps me, thanks to the discussion in the related commit:

flipped <- inherits(coord, "CoordFlip")

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

Successfully merging a pull request may close this issue.

4 participants