You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
slow rendering with backend_macosx on El Capitan #5964
With a fresh installation of mpl 1.5.1 from Anaconda on a new Macbook Air with El Capitan, there are long delays (several seconds) when rendering a multi-subplot figure based on cut/paste a section of script into an ipython window. This does not occur with the qt4agg backend.
I think we need to ensure the macosx backend is not selected by default, at least in the next mpl release on Anaconda.
Did this also happen on Mavericks, or is it new to El Capitan? (I'm still on Mavericks, so can confirm one way or the other if you can provide a script to reproduce...)
Is the copy-and-paste into IPython window critical, or does it also happen when running as a script?
It can be demonstrated with the script below, so it does not depend on cut/paste. On a new Macbook Air, part of the plot is displayed, it pauses, and then displays the rest. On Macbook Pro Retina machines, one with Mavericks and the other with Yosemite, it doesn't display anything until the plot is complete. On the Mavericks machine (mine) I can hear the fan and see the power consumption, so evidently it is working rather than waiting. Contrary to my initial guess, I think we are just seeing slower rendering of a very large number of points with the macosx backend compared to any agg backend. I suspect this has always been the case.
Nevertheless, I think this is one more reason for discouraging use of the macosx backend whenever an alternative is available--as it is in any Anaconda installation.
#/usr/bin/env pythonimportsysbackend=sys.argv[1]
importmatplotlibmatplotlib.use(backend)
importmatplotlib.pyplotaspltimportnumpyasnpfig, axs=plt.subplots(nrows=3)
nw=101n=300000x=np.arange(n, dtype=float)
y=np.cumsum(np.random.randn(n))
w=np.ones(nw, float) /nwy=np.convolve(y, w, mode='same')
axs[0].plot(x, y, '.')
axs[1].plot(x, y, '.')
axs[2].plot(x, y, '.')
plt.show()
In [15]: %timeit fig.canvas.draw()
1 loops, best of 3: 58.9 s per loop
and with qt4agg:
In [15]: %timeit fig.canvas.draw()
1 loops, best of 3: 614 ms per loop
It will be interesting to see how qt5agg handles it when that becomes available; according to @mdboom, it will support the full resolution, while qt4agg is operating in lo-res mode.
Presumably it will be something like the result of saving a png at high dpi:
In [16]: %timeit fig.savefig('test.png', dpi=320)
1 loops, best of 3: 4.26 s per loop
I switched the milestone to "unassigned" because this is not something we can fix in the present macosx backend. The solution will be to use an agg-based backend, either a presently existing one, or a modification of macosx to use agg.
Activity
mdboom commentedon Feb 3, 2016
Did this also happen on Mavericks, or is it new to El Capitan? (I'm still on Mavericks, so can confirm one way or the other if you can provide a script to reproduce...)
Is the copy-and-paste into IPython window critical, or does it also happen when running as a script?
efiring commentedon Feb 5, 2016
It can be demonstrated with the script below, so it does not depend on cut/paste. On a new Macbook Air, part of the plot is displayed, it pauses, and then displays the rest. On Macbook Pro Retina machines, one with Mavericks and the other with Yosemite, it doesn't display anything until the plot is complete. On the Mavericks machine (mine) I can hear the fan and see the power consumption, so evidently it is working rather than waiting. Contrary to my initial guess, I think we are just seeing slower rendering of a very large number of points with the macosx backend compared to any agg backend. I suspect this has always been the case.
Nevertheless, I think this is one more reason for discouraging use of the macosx backend whenever an alternative is available--as it is in any Anaconda installation.
tacaswell commentedon Feb 5, 2016
This is not super snappy with Agg
Switching to using pixel markers (
',') givesand using a line (with no markers) gives
Using
'o'as the marker is worseefiring commentedon Feb 5, 2016
On my Retina with the '.' marker and macosx:
and with qt4agg:
It will be interesting to see how qt5agg handles it when that becomes available; according to @mdboom, it will support the full resolution, while qt4agg is operating in lo-res mode.
Presumably it will be something like the result of saving a png at high dpi:
efiring commentedon Mar 16, 2016
I switched the milestone to "unassigned" because this is not something we can fix in the present macosx backend. The solution will be to use an agg-based backend, either a presently existing one, or a modification of macosx to use agg.
mdboom commentedon Mar 21, 2016
Fixed by #6178