Comments (14)
As I mentioned above, you have to add ax=ax
to adjust_text call:
fig, axes = plt.subplots(1, 2, figsize=(8, 3), sharex=True, sharey=True)
axes = axes.ravel()
for k, ax in enumerate(axes):
np.random.seed(0)
x, y = np.random.random((2,30))
ax.plot(x, y, 'bo')
texts = []
for i in range(len(x)):
t = ax.text(x[i], y[i], 'Text%s' %i, ha='center', va='center')
texts.append(t)
adjust_text(texts, ax=ax)
from adjusttext.
from adjusttext.
Thanks, I will try it out. BTW, will ax.set_xlim
or ax.set_ylim
have an effect on adjustText? I saw some strange behavior before.
from adjusttext.
from adjusttext.
@zyxue did this solve your problems?
from adjusttext.
@Phlya, thank you for asking, but no, it's not working yet. I am trying to get a minimal reproducible example
from adjusttext.
I've made an example at https://github.com/zyxue/adjustText/blob/master/figures/Examples-for-multiple-subplots.ipynb.
Also, it seems to be much slower than in a single-subplot case (17.9 ms vs 13.4 s).
from adjusttext.
Ah I see. I didn't fully get that. Ok, I will try it out later and let you know. Thank you!
from adjusttext.
Concerning timing, make sure you are using axes of the same size/shape, when comparing single vs multiple subplots. If they are slightly smaller in one case, it can slow down the execution considerably.
from adjusttext.
I don't fully understand what you mean by "If they are slightly smaller in one case, it can slow down the execution considerably".
I have updated my notebooks, why the time spent is so different for adjusting the first and second subplots, please?
CPU times: user 11.7 s, sys: 236 ms, total: 12 s
Wall time: 12 s
CPU times: user 2.52 s, sys: 57.8 ms, total: 2.57 s
Wall time: 2.58 s
BTW, are you interested in a pull request, I thought having a such an example for multiple subplots would be helpful to other users. It's a very useful package, thank you for sharing it.
from adjusttext.
Oh, I see. Interesting, I don't know why that is so different, for some reason it does a very different number of iterations each time! I'll try to investigate when I have time...
from adjusttext.
Yeah, would be great to add an example about this, you are not the first person to ask this question!
from adjusttext.
ok, I've sent a pull request. Not I also removed figures/.ipynb_checkpoints
from the commit as it's in your .gitignore
already.
from adjusttext.
Reopen because the time discrepancy for different subplots hasn't been resolsoved
Quote a previous comment:
CPU times: user 11.7 s, sys: 236 ms, total: 12 s
Wall time: 12 s
CPU times: user 2.52 s, sys: 57.8 ms, total: 2.57 s
Wall time: 2.58 s
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.