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

Automated Label Placement #61

Merged
merged 8 commits into from
Apr 28, 2022
Merged

Automated Label Placement #61

merged 8 commits into from
Apr 28, 2022

Conversation

martinvonk
Copy link
Contributor

This pull request adds an option for smart label placement using the adjustText package. Currently labels are only placed using an offset but that can cause labels to overlap:
Overzichtskaart_Meetnet_Aamsveen_old_labels
The adjust_text function from adjustText uses an iterative adjustment for label positions to minimize overlaps.
Overzichtskaart_Meetnet_Aamsveen_new_labels
In this example the adjust_text function is relatively slow (<1min) but in problems with fewer points and shorter label strings it is much faster

This does create an extra dependency but the adjustText package is really small and we already support all it's dependencies.

pastastore/plotting.py Outdated Show resolved Hide resolved
Copy link
Member

@dbrakenhoff dbrakenhoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments

Copy link
Member

@dbrakenhoff dbrakenhoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would just reuse one of the tests, see comment. After that, looks good!

…xt test

the old label method is already tested in test_map_oseries()
@dbrakenhoff dbrakenhoff merged commit f17cf7c into dev Apr 28, 2022
@dbrakenhoff dbrakenhoff deleted the adjust_labels branch April 28, 2022 12:00
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

Successfully merging this pull request may close these issues.

2 participants