-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Redrawing figure canvas after draw_event fails #10334
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
Recursive draws are explicitly ignored by qtagg
but I haven't thought much whether that was strictly needed. |
Thanks for the hint. A workaround is therefore to delay the redraw for some time. I guess a solution to the above example could then look like
This works well with TkAgg as well as Qt4Agg backends. |
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help! |
It seems that redrawing a figure inside a callback function connected to a
"draw_event"
does not work as intended. This issue would occur when a callback function tries to callfig.canvas.draw_idle()
.Sketch of the setup:
This issue is reproduced with python 2.7, matplotlib 2.1.2 on windows 8.1 using the Qt4Agg as well as the TkAgg backend.
Here is a full working example. This example is expected to draw a scatter point of the same size as a box in data coordinates. On draw_events, which happen e.g. by zooming the axes, the scatter size should update to match the box' extention.
The actual outcome of this is that when zooming, the scatter size is updated, but the figure is not redrawn, such that the scatter keeps its previous size on screen. One needs to explicitely trigger another draw event (e.g. by clicking inside the axes) for the changes to be reflected in the figure.
Workaround:
As a workaround one may explicitely draw the axes again inside the updating funtion.
However, this results in the axes being drawn twice. This at least seems so, because the axis labels are now bolder than before, suggesting that they are overlayed by a previous version of them. Again after clicking (and hence drawing the figure again), the labels appear in their normal typesetting.
The question would be: Why is
fig.canvas.draw_idle()
ignored? Is this a wrong expectation from my side? Is there something in the code that explicitely forbidds a draw_event beeing triggered from a draw_event callback?Note that according to some discussion below a stackoverflow question it seems at least one person cannot reproduce the reported behaviour, so it may well be an issue restricted to python 2 or windows or some other unknown parameter.
The text was updated successfully, but these errors were encountered: