Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make adjustText available for web frameworks #130

Open
martstr opened this issue Aug 12, 2022 · 1 comment
Open

Make adjustText available for web frameworks #130

martstr opened this issue Aug 12, 2022 · 1 comment

Comments

@martstr
Copy link

martstr commented Aug 12, 2022

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.

@oscargus
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants