ggrepel icon indicating copy to clipboard operation
ggrepel copied to clipboard

WIP: basic outline of base version of repel

Open MichaelChirico opened this issue 4 years ago • 7 comments

Some initial work on #156

The skeleton is there -- API I envision is expose repel_text (or maybe text_repel) as the "repel" version of graphics::text.default

TODO:

  • [x] Implement pos argument
  • [x] Implement offset argument
  • [ ] Thorough testing of expected outputs
  • [ ] Don't draw segments if the text "hasn't moved" (?)
  • [ ] Examples
  • [ ] NEWS
  • [ ] Clean-up

MichaelChirico avatar May 07 '20 08:05 MichaelChirico

@slowkow any general comments on API / expected behavior / style are welcome at any time

MichaelChirico avatar May 07 '20 12:05 MichaelChirico

Thanks for working on this! I think I might prefer text_repel() instead of repel_text().

I don't use base graphics very often, so I'm not sure what the preferred interface would be for someone who does. We might want to ask for comments from someone who does use base when you're ready.

When you're ready, could I please ask if you might be able to share a figure that shows this working?

Does the figure redraw if you resize the window? Like this.

slowkow avatar May 07 '20 12:05 slowkow

Does the figure redraw if you resize the window?

I can't imagine it would 🤔

I guess ggplot2 is handling that through its special infra -- resizing the plot window re-induces print.ggplot2, which can re-calculate the plot elements.

This could be captured by a dynamic plotting environment for base (e.g. on shiny), but I am not sure it's possible for unadorned base plots.

MichaelChirico avatar May 07 '20 13:05 MichaelChirico

@slowkow I added test-base-plots.R (I'll delete it or migrate it before merge), plan is to do a ton of test plots in there.

MichaelChirico avatar May 08 '20 04:05 MichaelChirico

@slowkow now tracking plots in this PR under test-base/figures

MichaelChirico avatar May 08 '20 12:05 MichaelChirico

Thanks for working on this! Let me know when you want me to have a deeper look. I can be slow to respond and might need multiple reminders.

slowkow avatar Jul 23 '20 15:07 slowkow

Thanks @slowkow -- IIRC there was an issue where the results are highly volatile. Maybe that's an issue you've seen with the gg version of the algorithm as well. I haven't had time to get back to investigate more...

MichaelChirico avatar Oct 20 '20 02:10 MichaelChirico