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

Feature request: set continuous limits for discrete scales #6259

Open
Yunuuuu opened this issue Dec 21, 2024 · 6 comments · May be fixed by #6273
Open

Feature request: set continuous limits for discrete scales #6259

Yunuuuu opened this issue Dec 21, 2024 · 6 comments · May be fixed by #6273
Labels
feature a feature request or enhancement scales 🐍

Comments

@Yunuuuu
Copy link
Contributor

Yunuuuu commented Dec 21, 2024

is it possible to set limits in coord_radial()? Just like what we do in coord_cartesian(xlim = *, ylim = *)

@teunbrand
Copy link
Collaborator

This has been suggested before for coord_polar() in the ancient #43. I think setting the limits in the coord_*() hails from a time when there was no scales::oob_keep() to indicate that out of bounds data shouldn't be discarded. I'd gladly remove the xlim and ylim arguments in other coords if ggplot2 didn't advertise it as 'zoom limits' and it weren't a backwards compatibility issue.

@Yunuuuu
Copy link
Contributor Author

Yunuuuu commented Jan 6, 2025

Coord limits provide an effective way to precisely align axis values, especially since ggplot2 currently does not support setting limits by numerical values alone. This feature enables the alignment of plots with different axis types (continuous and discrete). Removing it would break ggalign, as the package relies heavily on it to align both discrete and continuous axes. With this capability, ggalign can generate highly complex figures, such as the one shown below:

Image

Image

Image

@teunbrand
Copy link
Collaborator

Removing it

It probably won't be removed, precisely because it would cause a lot of breakage all over the ecosystem.

ggplot2 currently does not support setting limits by numerical values alone.

Perhaps it should be easier to set continuous limits for discrete scales.

@Yunuuuu
Copy link
Contributor Author

Yunuuuu commented Jan 6, 2025

It probably won't be removed, precisely because it would cause a lot of breakage all over the ecosystem.

Thanks for the clarification.

Perhaps it should be easier to set continuous limits for discrete scales.

It would be great if this could be possible. While I initially tried aligning plots using scale limits, I found it challenging to align various plots consistently and eventually, I switched to using coord limits.

@teunbrand
Copy link
Collaborator

It would be great if this could be possible

Alright I'll repurpose this issue for setting the continuous range of discrete scales then.

@teunbrand teunbrand added feature a feature request or enhancement scales 🐍 and removed coord 🗺️ labels Jan 7, 2025
@teunbrand teunbrand changed the title Feature request: set limits for coord_radial() Feature request: set continuous limits for discrete scales Jan 7, 2025
@teunbrand teunbrand linked a pull request Jan 7, 2025 that will close this issue
@Yunuuuu
Copy link
Contributor Author

Yunuuuu commented Jan 8, 2025

Thanks! This is awesome. I really appreciate it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement scales 🐍
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants