Comments (9)
Right, thanks, of course... This should be very easy to fix though, would you like to submit a PR?
from adjusttext.
Hm, it actually seems non-trivial to me because I don't fully understand the code in the repel_*
functions. Like, in repel_text
here, I don't get why it's multiplying by two. If those are supposed to be the coords of the centre of the text bboxes, shouldn't it be dividing by 2?
Also digging more into repel_text_from_points
, I think I found a bug (#49).
So I think I'll leave this one to you. I might take a shot at a PR for one or both of the other two earlier issues (#45 and #46), but I can't guarantee it'll be in a timely fashion, so if you want to go ahead and quickly scratch them off, feel free.
from adjusttext.
Concerning multiplication by 2 - keep in mind that those are lists, not arrays, and this is simply used to create pairs of coordinates of corners, not centers of bboxes. The logic is that if neither rectangle contains any corners of the the other rectangle, these rectangles don't overlap. May not be the simplest way to test this...
from adjusttext.
You actually got me thinking, and this is not strictly true in all cases - i.e. one vertical rectangle can overlap with a horizontal one with all corners being outside. But as far as all rectangles are the same height (which is typically true), this should hold... But probably this should be generalized just in case, and simply checking for left side being to the right of the right side of the other rectangle (and same for all other sides) should be very easy and work 100%.
from adjusttext.
As a note to my future self, this looks interesting
https://github.com/Pithikos/python-rectangles
from adjusttext.
Or, shapely
, of course - maybe all calculation should migrate to using it? Then, perhaps, we can properly support non-rectangular objects?
from adjusttext.
Ah, I get it, sorry I thought they were arrays when I first looked at it. That also explains the modulo!
That's a good point about the corners possibly not being contained. I'm not familiar with either of those libraries, but they look promising. Presumably you could also just use the bbox.intersection
method for each pair, but maybe that would be too expensive.
from adjusttext.
That's why I used this approach, but it might have been a premature optimization...
from adjusttext.
I think this is fixed in the recent commit - the main issue reported here, that is, not the intersection algorithm.
from adjusttext.
Related Issues (20)
- Time Limit HOT 2
- Altering Data HOT 3
- Please be mindful of the versions HOT 10
- Example of integrating seaborn.object()
- Plotly support? HOT 1
- Feature request: Fix output (specify iteration limit instead of time) HOT 2
- Is the `bioframe` dependency necessary? HOT 3
- Just started not working one day with this error HOT 2
- Version 1.0.3 has a non declared dependency on pandas HOT 1
- force_points key word removed? HOT 2
- Labels misplaced in subplots HOT 1
- Issue with "matplotlib.axes.Axes.annotate" using the arguments "xytext" and "textcoords" HOT 5
- Poor Result when avoiding a polygonal curve HOT 6
- adjustText 1.1 doesn't work properly anymore HOT 6
- Arrows disappear when using cartopy transformation HOT 11
- query_pairs unexpected argument HOT 3
- Numpy 2.0 related issue - use of 'np.Inf`' HOT 3
- update to work with numpy 2.0 HOT 1
- Prevent text overlapping scaled scatter points HOT 3
- avoid crossing of the connector lines HOT 17
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from adjusttext.