Skip to content

Should nudging aesthetics be named xnudge and ynudge? #6468

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
davidhodge931 opened this issue May 20, 2025 · 7 comments
Closed

Should nudging aesthetics be named xnudge and ynudge? #6468

davidhodge931 opened this issue May 20, 2025 · 7 comments

Comments

@davidhodge931
Copy link

Should nudging aesthetics be named xnudge and ynudge?

Would seem to align with the other aesthetics better, and would improve the findability of the nudge aesthetics.
x
xmin
xend
xmax
xnudge

However, appreciate this would mean changing nudge_x and nudge_y to xnudge and ynudge in geom_text and geom_label.

But I think this would be worthwhile for the improvements to the API.

Definitely last issue now - sorry!!

@teunbrand
Copy link
Collaborator

teunbrand commented May 21, 2025

Thanks for the consideration David! I'm going to position myself in the 'no' camp for these reasons:

  1. They are aesthetics specific to position_nudge(). They aren't widely spread aesthetics so discoverability isn't paramount.
  2. Despite being aesthetics of a position adjustment, they're not actually position aesthetics. They're similar to width or height in that they affect the position, but they aren't mapped to the scale. For that reason, calling these xnudge/ynudge would wrongly imply, by similarity to actual position aesthetics, that these would be mapped.
  3. Historically, they're transfers from geom_text(nudge_x, nudge_y), so we'd like that to continue to work and not finagle with renaming these arguments on the fly.

@davidhodge931
Copy link
Author

Good points, thanks.

Something else to consider is whether the nudge arguments in geom_text would eventually need to be renamed to nudge.x and nudge.y anyway, if ggplot2 is going to have consistent arguments with a dot instead of a dash?

@teunbrand
Copy link
Collaborator

whether the nudge arguments in geom_text would eventually need to be renamed to nudge.x and nudge.y

They will no longer be arguments to geom_text(), but aesthetics. I don't think there is a clear precedent for aesthetics, but it doesn't need to follow the argument precedent per se. Besides, there are some exceptions to the dot.case rule for arguments anyway.

@davidhodge931
Copy link
Author

For aesthetics, the naming convention seems to be, do not separate words..

Xmin
Xmax
Xend
Linewidth
Linetype

@davidhodge931
Copy link
Author

Okay, not quite as simple as I thought with some *_final aesthetics. But everything is prefixed by x and y, and does not use a underscore between the x or y and next word. So I still think xnudge and ynudge is consistent with the existing API, and nudge_x and nudge_y isn't.

Image

https://ggplot2.tidyverse.org/reference/aes_position.html

@teunbrand
Copy link
Collaborator

The width and height aesthetics also don't start with x or y and are similar to nudge_x/nudge_y in that they are position-related aesthetics, but not position aesthetics. I don't think the consistency argument holds as much weight as the pain it is to rename them.

@davidhodge931
Copy link
Author

Fair enough, always a pain renaming - thanks for the consideration

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

2 participants