Comments (2)
Thank you, I merged your PR!
from adjusttext.
I wanted deterministic output, so I added the iter_lim
argument to adjust_text()
function in #165.
I verified with the following code that the output does not change each time.
from pathlib import Path
from adjustText import adjust_text
import matplotlib as mpl
from matplotlib.figure import Figure
import matplotlib.pyplot as plt
import numpy as np
def draw_fig(n_points: int = 80) -> Figure:
# like the example from https://adjusttext.readthedocs.io/en/latest/Examples.html
np.random.seed(0)
x, y = np.random.random((2, n_points))
fig, ax = plt.subplots()
ax.plot(x, y, "bo")
texts = [ax.text(x[i], y[i], f"Text{i}") for i in range(n_points)]
adjust_text(texts, ax=ax, iter_lim=50)
plt.close()
return fig
mpl.rcParams["svg.hashsalt"] = "0" # make SVG deterministic
svg_files: list[Path] = []
for i in range(2):
fig = draw_fig()
filepath = Path(f"fig_{i}.svg")
svg_files.append(filepath)
fig.savefig(filepath, metadata={"Creator": None, "Date": None})
assert svg_files[0].read_text() == svg_files[1].read_text(), "SVG files differ"
fig_0.svg | fig_1.svg |
---|---|
versions of packages in my environment
# Name Version Build Channel
bioframe 0.6.0 pypi_0 pypi
matplotlib 3.8.2 py312h2e8e312_0 conda-forge
numpy 1.26.3 py312h8753938_0 conda-forge
python 3.12.1 h2628c8c_1_cpython conda-forge
scipy 1.11.4 py312h8753938_0 conda-forge
If you like this modification, please merge it!
from adjusttext.
Related Issues (20)
- Add documentation link to the dedicated place HOT 1
- "New engine" changed behavior HOT 4
- Node.js 12 actions are deprecated HOT 7
- 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
- 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 2
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.