IndexError in case of empty texts
glemi opened this issue · comments
glemi commented
I have this error occurring in my code in case I call adjust_text
with an empty list of text objects.
plt.draw()
ax = ax or plt.gca()
r = get_renderer(ax.get_figure())
> transform = texts[0].get_transform()
E IndexError: list index out of range
/usr/local/lib/python3.7/site-packages/adjustText/__init__.py:567: IndexError
The error didn't occur in v0.7.3 but it does now after I updated adjustText to v0.8.
It's an easy fix on my side, but you may want to handle the case of client code supplying an empty list of texts.