Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Description
Bug report
This is a follow up to the glitching noted in#19059.
Bug summary
If you are not forcing a full frontend redraw and are sending messages to the frontend fast enough then there can be artifacts left in the plot.
Code for reproduction
importitertoolscnt=itertools.count()bg=Nonedefonclick_handle(event):"""Should draw elevating green line on each mouse click"""globalbgifbgisNone:bg=ax.figure.canvas.copy_from_bbox(ax.bbox)ax.figure.canvas.restore_region(bg)cur_y= (next(cnt)%10)*0.1ln.set_ydata([cur_y,cur_y])ax.draw_artist(ln)ax.figure.canvas.blit(ax.bbox)fig,ax=plt.subplots()ax.plot([0,1], [0,1],'r')ln,=ax.plot([0,1], [0,0],'g',animated=True)plt.show()ax.figure.canvas.draw()ax.figure.canvas.mpl_connect('button_press_event',onclick_handle)
Expected outcome
Only one green line should be ever be present.
Matplotlib version
- Operating system:
- Matplotlib version: Master
- Matplotlib backend (
print(matplotlib.get_backend())
): nbAgg or ipympl - Python version:
- Jupyter version (if applicable): Jupyterlab 2.2.9
In#19059 (comment)@tacaswell noted the following:
@danielballan has also noticed this form of glitching in ipympl and is interested in fixing it. I agree the issue is that via some mechanism one or more of the diff frames are being lost or processed out of order. We either need to make the front ends smart enough to detect this (by tacking a frame number on to everything and verifying that that they come in order) or on the kernel side force a non-diff every N frame (aka key-frames analogous to the way that mpeg works internally).