-
-
Notifications
You must be signed in to change notification settings - Fork 7.8k
IPython is always imported by pyplot, if present #5037
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
Comments
This prevents importing IPython if it is not already imported. closes matplotlib#5037
Hmm, going back to what I said in the line comments of #4506, lets control this auto-redraw based on a simple rcParam check rather than using iPython... |
There are two ways to deal with clearing the stale state. Either when the figure comes stale it can tell the canvas to schedule a re-draw at it's next opportunity (which is what happens currently if you are not in I very much prefer option 2 as it puts control of the draw cadence in the hands of the event loop that is running the show, instead of mpl constantly poking at the canvas. It prevents any possibility of the nasty infinite draw-triggering-draw loops that we had to deal with (but I think those are all sorted out for the backends we ship). The plain python repl does not have a convenient place to hook a callback function into, hence in that case we have to use the push pattern. I don't see how in either case an rcparam helps deal with when to trigger asynchronous draws. |
It's greatly improved, but I'm still seeing a considerable increase in import time from 1.4.3 to master, with #5038 included. The number of function calls has gone from 179,087 to 252,421, and the time is still about 100 ms longer (280 to 380) on my Linux VM. The increase is split between the |
according to git we are net +22k LoC, but a lot of that is probably svgs
|
Option 1 is the traditional way of organizing event loops on Windows, Mac, X11. I would suggest to consider carefully why matplotlib would need an approach different from other GUI programs.
I believe you were looking for a function that is called when Python is waiting for the next command? |
Yes, I thought we had Anyway, not a biggie, I think we can change to this or some other behaviour safely enough at a later point... but I thought if we needed to get rid of that IPython import now, then we can/should do it this way. |
When IPython is present, the import time for pyplot is roughly doubled because IPython is imported by
install_repl_displayhook()
. This is true even withmatplotlib.use('agg')
, so it will affect all scripts using pyplot.The text was updated successfully, but these errors were encountered: