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

matplotlib.pyplot.ion() does not work very well #46

Open
xhao79 opened this issue Jun 13, 2016 · 3 comments
Open

matplotlib.pyplot.ion() does not work very well #46

xhao79 opened this issue Jun 13, 2016 · 3 comments

Comments

@xhao79
Copy link

xhao79 commented Jun 13, 2016

When using following code in PythonQt, the plotting window has no interaction, for example, zooming, save figures:

import matplotlib.pyplot as plt
plt.ion()
plt.plot([1,2,3], [1,2,1])
plt.draw()

I even could not close the plotting window with clicking the 'close button' on the title bar.

@jcfr
Copy link
Member

jcfr commented Jun 13, 2016

Thanks for reporting the problem.

This is most likely explained by the fact plt.draw() creates its own event loop.

An approach would be to subclass an existing matplotlib backend.

While PyQt is different from PythonQt, here are some hints that should apply:

Related docs:

May be you could try:

plt.show(block=False)

@jmirabel
Copy link

Hello,

following the advice on that topic, I hit a few bugs but I managed to get a working backend to integrated matplotlib in PythonQt. At its current stage, it is probably not perfect. I have two questions:

  • would you be interested in including this backend in the package ?
  • If yes, is a draft version fine ?

@jmirabel
Copy link

jmirabel commented Feb 7, 2018

The code can be found on branch matplotlib of my fork: https://github.com/jmirabel/PythonQt/tree/matplotlib (based on branch patched-6 of this fork).

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

No branches or pull requests

3 participants