Skip to content

Floating axes #5190

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
grantmcdermott opened this issue Feb 17, 2023 · 2 comments
Closed

Floating axes #5190

grantmcdermott opened this issue Feb 17, 2023 · 2 comments

Comments

@grantmcdermott
Copy link

grantmcdermott commented Feb 17, 2023

The base plot method allows you to pass a frame.plot = FALSE argument, which removes the outline box. Because plot draws non-intersecting axes by default, this provides an easy way to achieve the (in my view) aesthetically pleasing effect of floating axes.

plot(
  dist ~ speed, 
  data = cars,
  frame.plot = FALSE
  )

Created on 2023-02-16 with reprex v2.0.2

Of course, some other base plotting functions---most obviously hist---do this automatically.

To the best of my knowledge, there is no direct way to achieve the same floating effect of non-intersecting axes in ggplot2. The workarounds that I've seen generally involve some hacks with segment. For example, see this SO answer and I believe that this is also what ggthemes does behind the scenes with its geom_rangeframe function. Unfortunately, I've found these workarounds to be quite brittle/unreliable, producing ugly artefacts with certain datasets or more complex plot constructions like faceting (ticks not lining up with the axis ends, etc.)

It would be great if we could disable axes intersection (but not turn them off completely) as part of a regular theme argument.

Thanks for considering and for maintaining this essential package.

@teunbrand
Copy link
Collaborator

Hi there, this looks like the same request as #4907, so it would seem best to keep discussion in one place over there.

@teunbrand teunbrand closed this as not planned Won't fix, can't repro, duplicate, stale Feb 17, 2023
@grantmcdermott
Copy link
Author

Ah, sorry missed it. Thanks and will follow there.

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