Comments (6)
@zealseeker Yes, it's actually quite powerful, because you can specify any "restricted" region on the plot, but does require some fiddling with the parameters sometimes.
That's weird, I think this shouldn't happen, because both of them should restrict movement to only along the y axis... I'll look into it when I have time. Also if you don't mind I'd like to add your example to my example notebook, I think this is probably quite a common use case.
I also hope it becomes popular, thank you!
from adjusttext.
Hi zealseeker, thanks for trying it. My guess is that this has to do with different size of the subplot (because that's the only thing that is different really and it can influence overlaps between labels). However if you want to avoid labels moving down, you have to add virtual points below the top of your bars, otherwise there is nothing preventing them from doing it. Let me know if it helps!
from adjusttext.
@Phlya unfortunately, even substantial points cannot fix this problem (I have updated the notebook in my repository) . Is it possible and necessary to restrict the moving direction besides axis. For example only_move={'text':'y+'}
means that the label can only move upward ?
from adjusttext.
@zealseeker I think you misunderstood what I meant.
First, a comment: you want to have your labels above bars and at their centers. So it's best to specify this when adding texts (texts.append(ax.text(left,top,'%.3f'%y[j], horizontalalignment='center'))
). (I actually don't understand why you get centered labels if you don't do it...)
And about adding points. You don't need to plot any additional points, but rather supply the adjust_text
function with virtual points in the x and y parameters. I modified your notebook and created a PR for you to have a look.
I have been thinking about adding this functionality, but haven't found the time to implement it yet.
from adjusttext.
(Oh, actually you use the left side of bars as the x coordinate to add texts...)
from adjusttext.
@Phlya Thank you. It's a good way to temporarily solve the problem. But acturally I found that horizontalalignment='center'
is not necessary. The labels get centered due to autoalign='y'
. Both of autoalign='y', only_move={'points':'y', 'text':'y'}
are indispensable, or else the labels would run away.
Anyhow, thank you very much and hope the module will be updated and become popular.
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 11
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.