This notebook presents a working example of adjusting texts for multiple subplots, related to https://github.com/Phlya/adjustText/issues/58
[1]:
%matplotlib inline
import matplotlib.pyplot as plt
from adjustText import adjust_text
import numpy as np
import pandas as pd
With multiple subplots, run adjust_text
for one subplot at a time
[2]:
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)
[ ]: