adjustText icon indicating copy to clipboard operation
adjustText copied to clipboard

Make adjustText available for web frameworks

Open martstr opened this issue 3 years ago • 1 comments

According to the matplotlib documentation, one should not use pyplot with web frameworks such as Django or Flask. Instead,

[s]ince Matplotlib 3.1, one can directly create figures using the Figure constructor and save them to in-memory buffers. In older versions, it was necessary to explicitly instantiate an Agg canvas (see e.g. CanvasAgg demo).

Now, as I changed this in my Django application, adjustText stopped working*. I see that it is importing pyplot explicitly. Is it feasible to change adjustText so that it only uses matplotlib.figure.Figure?

*) If I annotated a scatter plot with .text(), adjust_text() would remove all texts. If I used .annotate(), it would not move all labels quite a bit right, but not make any useful changes.

martstr avatar Aug 12 '22 10:08 martstr

It may be that #141 will solve this if you pass the ax argument.

oscargus avatar Feb 27 '23 10:02 oscargus