Skip to content

Feature request: Allow expanding only horizontally or vertically in coords_cartesian #3513

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
tmalsburg opened this issue Aug 31, 2019 · 5 comments

Comments

@tmalsburg
Copy link

The function coords_cartesian has a parameter called expand that allows us to expand the x- and y-limits around the data a bit. Possible values are TRUE for expanding and FALSE for not expanding. I encountered multiple cases were it would have been useful to be able to expand just in the x- or y-dimension. Please consider adding these options. Thank you.

@clauswilke
Copy link
Member

Could you please do a search for this topic among recent open and closed issues, and link back here to what you find? There have definitely been discussions of this topic, but I don't remember the latest status.

@tmalsburg
Copy link
Author

I had searched for coords_cartesian expand but that didn't yield any results. When searching just for expand, I get lots of results but they seem only vaguely related, e.g: #3371, #3270, #3338.

Through this search I found that I can use scale_x_continuous(expand=c(0, 0)) to selectively disable expansion on one axis. While this is useful, I still think it would be good to have more options for coords_cartesian's expand parameter.

@clauswilke
Copy link
Member

According to the discussion in #3270, expansion in coords can be controlled via the scale functions. In general, I believe the ggplot2 philosophy has been to set axis-specific properties via scale functions rather than via coord(*), to avoid overly complicated interfaces in coords. Is there anything you cannot currently do (i.e., a true missing feature), or are you only asking for a convenience change to the API?

(*) The same is true for brakes, labels, axis titles, etc. Those properties are all set via scale functions, not via coords.

@tmalsburg
Copy link
Author

No feature is missing, afaict. It's just confusing when you can set some aspects of expansion with coords_cartesian but for more fine-grained control you need to look elsewhere. In this regard, the API is already overly complicated and slightly misleading IMO. Thanks for your responses and please feel free to close this issue.

@lock
Copy link

lock bot commented Jun 24, 2020

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Jun 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants