causes Figure.draw to be called 155 times with the code currently in master.
With matplotlib 1.4.3, Figure.draw is called twice (once to create the PNG, and once to redraw the figure).
I am guessing that this has to do with the default implementation of draw_idle in FigureCanvasBase. Currently it calls draw().
So then if I change a property of the figure, the figure gets marked as stale, draw_idle is called, draw_idle calls draw, which resets the figure as non-stale.
causes Figure.draw to be called 155 times with the code currently in
master.
With matplotlib 1.4.3, Figure.draw is called twice (once to create the
PNG, and once to redraw the figure).
I am guessing that this has to do with the default implementation of
draw_idle in FigureCanvasBase. Currently it calls draw().
So then if I change a property of the figure, the figure gets marked as
stale, draw_idle is called, draw_idle calls draw, which resets the figure
as non-stale.
—
Reply to this email directly or view it on GitHub #4780.
With 1.5.0, the example above before the call to savefig causes five calls to Figure.draw.
With the pdf, svg, and interactive backends, there is only one call to Figure.draw.
This is because Agg does not actually have an asynchronous draw_idle call, just a safely re-entrant one. The extra 4 draw calls from the various figure/axes construction steps where a synchronous draw is forced every time an attribute is changed. This is a consequence of calling draw_idle on every flip to stale.
If you turn interactive mode off you will not get the extra draws (as the hook isn't installed) or if you run this in IPython (as we use their post execute hooks to get the asynchronous draw instead of relying on the backends to provide it) you will not get the extra draws.
The svg and pdf backends don't have a functional draw method (their main logic is in the print_* methods iirc).
Maybe we should raise when interactive mode is enabled with non-interactive backends, but that seems like a lot of extra complication for not much payoff.
I am in favor of closing this issue as I don't think we can do better than this in the case where
Activity
WeatherGod commented on Jul 24, 2015
Could this possibly be addressed by #4738?
On Fri, Jul 24, 2015 at 5:54 AM, mdehoon notifications@github.com wrote:
tacaswell commented on Jul 24, 2015
It is fixed by #4738 which is now a couple of changes merged together.
mdehoon commented on Nov 13, 2015
With 1.5.0, the example above before the call to savefig causes five calls to Figure.draw.
With the pdf, svg, and interactive backends, there is only one call to Figure.draw.
tacaswell commented on Nov 13, 2015
This is because Agg does not actually have an asynchronous draw_idle call, just a safely re-entrant one. The extra 4 draw calls from the various figure/axes construction steps where a synchronous draw is forced every time an attribute is changed. This is a consequence of calling draw_idle on every flip to stale.
If you turn interactive mode off you will not get the extra draws (as the hook isn't installed) or if you run this in IPython (as we use their post execute hooks to get the asynchronous draw instead of relying on the backends to provide it) you will not get the extra draws.
The svg and pdf backends don't have a functional draw method (their main logic is in the print_* methods iirc).
Maybe we should raise when interactive mode is enabled with non-interactive backends, but that seems like a lot of extra complication for not much payoff.
I am in favor of closing this issue as I don't think we can do better than this in the case where
mdehoon commented on Nov 13, 2015
I don't have a strong opinion on this matter. I'm OK with closing this issue.