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

Accept numbers in addition to units to *.padding, *.length #79

Closed
seaaan opened this issue Jul 7, 2017 · 1 comment · Fixed by #80
Closed

Accept numbers in addition to units to *.padding, *.length #79

seaaan opened this issue Jul 7, 2017 · 1 comment · Fixed by #80

Comments

@seaaan
Copy link
Contributor

seaaan commented Jul 7, 2017

Instead of writing

geom_label_repel(box.padding = unit(0.25, "lines"),
  label.padding = unit(0.25, "lines"), point.padding = unit(1e-06, "lines"),
  label.r = unit(0.15, "lines"),  min.segment.length = unit(0.5, "lines"))

it would be nice to write

geom_label_repel(box.padding = 0.25, label.padding = 0.25, 
  point.padding = 1e-06, label.r = 0.15, min.segment.length = 0.5)

and have it automatically convert those arguments to line units behind the scenes. This would be a useful shorthand, but it should also still accept units in case someone wants to use a non-line unit.

I'd be happy to implement this and submit a pull request if you think it's a good idea. Thanks for this package, I love it!

@slowkow
Copy link
Owner

slowkow commented Jul 7, 2017

Thanks for the great suggestion! Generally, I want to make ggrepel feel like just another ggplot2 function, and I think your suggestion helps. I'd be happy to add you as a contributor if you send a pull request.

Ideally the unit(0.15, "lines") syntax should still work after you pull request. I don't know if that's possible or not. I'd have to poke around the ggplot2 code to see if a similar feature exists over there.

Thanks again!

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.

2 participants