Comments (5)
You need to define new graph
variable before adding texts to it. And your try:
-except:
constructs hid that adjustment didn't work at all and actually raised an error.
labels = ['test1', 'test2', 'test3', 'test4', 'test5', 'test6', 'test7', 'test8', 'test9', 'test10', 'test11', 'test12', 'test13', 'test14', 'test15']
x = [4.00, 3.50, 3.50, 3.50, 3.50, 3.50, 3.50, 3.50, 3.50, 3.50, 3.50, 3.50, 3.50, 3.50, 3.50]
y = [2.50, 2.55, 2.60, 2.65, 2.70, 2.75, 2.80, 2.85, 2.90, 2.95, 3.00, 3.50, 3.35, 3.25, 3.50]
ax1 = plt.subplot2grid((2,2), (0,0), rowspan=1, colspan=1)
ax2 = plt.subplot2grid((2,2), (0,1), rowspan=1, colspan=1)
ax3 = plt.subplot2grid((2,2), (1,0), rowspan=1, colspan=1)
ax4 = plt.subplot2grid((2,2), (1,1), rowspan=1, colspan=1)
ax1.scatter(x, y, c='b', alpha=1, vmin=0, vmax=4, zorder=2)
ax2.scatter(x, y, c='b', alpha=1, vmin=0, vmax=4, zorder=2)
ax3.scatter(x, y, c='b', alpha=1, vmin=0, vmax=4, zorder=2)
ax4.scatter(x, y, c='b', alpha=1, vmin=0, vmax=4, zorder=2)
ax1.set_xlim(0,3)
ax2.set_xlim(3,4)
ax3.set_xlim(0,3)
ax4.set_xlim(3,4)
ax1.set_ylim(3,4)
ax2.set_ylim(3,4)
ax3.set_ylim(0,3)
ax4.set_ylim(0,3)
ax1.plot([3,3],[0,4], linewidth=3, color='black')
ax1.plot([0,4],[3,3], linewidth=3, color='black')
ax2.plot([3,3],[0,4], linewidth=3, color='black')
ax2.plot([0,4],[3,3], linewidth=3, color='black')
ax3.plot([3,3],[0,4], linewidth=3, color='black')
ax3.plot([0,4],[3,3], linewidth=3, color='black')
ax4.plot([3,3],[0,4], linewidth=3, color='black')
ax4.plot([0,4],[3,3], linewidth=3, color='black')
graph=[]
for i, txt in enumerate(labels):
if(x[i]>=0 and x[i]<=3 and y[i]<=4 and y[i]>3):
graph.append(ax1.text(x[i], y[i], txt, color='purple', size=8, bbox=dict(boxstyle="square", fc="w", pad=0.2)))
adjust_text(graph, ax=ax1, arrowprops=dict(arrowstyle="->"))
graph = []
for i, txt in enumerate(labels):
if(x[i]<=4 and x[i]>3 and y[i]<=4 and y[i]>3):
graph.append(ax2.text(x[i], y[i], txt, color='purple', size=8, bbox=dict(boxstyle="square", fc="w", pad=0.2)))
adjust_text(graph, ax=ax2, arrowprops=dict(arrowstyle="->"))
graph = []
for i, txt in enumerate(labels):
if(x[i]>=0 and x[i]<=3 and y[i]>=0 and y[i]<=3):
graph.append(ax3.text(df.x[i], df.y[i], txt, color='purple',size=8,bbox=dict(boxstyle="square", fc="w", pad=0.2)))
adjust_text(graph, ax=ax3, arrowprops=dict(arrowstyle="->"))
graph = []
for i, txt in enumerate(labels):
if(x[i]<=4 and x[i]>3 and y[i]>=0 and y[i]<=3):
graph.append(ax4.text(x[i], y[i], txt, color='purple', size=8, bbox=dict(boxstyle="square", fc="w", pad=0.2)))
adjust_text(graph, ax=ax4, arrowprops=dict(arrowstyle="->"))
plt.show()
from adjusttext.
Can you please make a minimal reproducible example?
from adjusttext.
Example of the graph is attached here.
from adjusttext.
With code, please
from adjusttext.
.py Code here:
scatter.txt
Sorry accidentally closed the issue >.<
from adjusttext.
Related Issues (20)
- Backends to use in a multithreaded environment HOT 4
- 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
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.