the get_text_position uses ax.convert_xunits which seems to return either a float for numerical data or an ndarray containing the category index for categorical.
this raises the following error when trying to apply a transformation to the text:
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2,) + inhomogeneous part.
currently using the following code as a test:
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from adjustText import adjust_text
data = pd.DataFrame({
'x': ["Cat", "Dog", "Bird"]*3,
'y': [0, 0, 0, 20, 20, 20, 0.5, 19.5, 19.5],
'label': [x%2==0 for x in np.random.randint(0, 20, 9)]
})
fig = plt.figure()
ax = fig.add_subplot()
ax.scatter(x=data['x'], y=data['y'])
annotations = [ax.annotate(text=t, xy=(x,y)) for x,y,t in zip(data['x'], data['y'], data['label'])]
adjust_text(annotations)
the
get_text_position
usesax.convert_xunits
which seems to return either a float for numerical data or an ndarray containing the category index for categorical. this raises the following error when trying to apply a transformation to the text:ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2,) + inhomogeneous part.
currently using the following code as a test:
current figure (doesn't run adjusttext):