Closed
Description
Hi, on the nbagg backend, blit doesn't seem to update without re-drawing. Here's a simple example:
import matplotlib.pyplot as plt
prev_artist = None
cur_y = 0.1
def onclick_handle(event):
"""Should draw elevating green line on each mouse click"""
global ax, bg, prev_artist, cur_y
ax.figure.canvas.restore_region(bg)
if prev_artist:
prev_artist.remove()
cur_y += 0.1
prev_artist = ax.plot([0, 1], [cur_y, cur_y], 'g')[0]
ax.draw_artist(prev_artist)
ax.figure.canvas.blit(ax.bbox)
print "Drew line"
ax = plt.gca()
ax.plot([0, 1], [0, 1], 'r')
# ax.figure.canvas.draw()
bg = ax.figure.canvas.copy_from_bbox(ax.bbox)
ax.figure.canvas.mpl_connect('button_press_event', onclick_handle)
With %matplotlib nbagg
, clicking on the plot doesn't cause any updates until the plot is re-drawn. With other backends (say qt) the plot updates immediately on clicking.
An unrelated oddity, if I uncomment the draw command and try re-drawing the figure just disappears (edit - on 1.4.3; seems fixed on 1.5.1dev1).
If it helps, IPython version is 2.3.0 and matplotlib is 1.4.3/1.5.1dev1; occurs on both chrome and firefox. UAT including animation example more or less run fine.
(Coincidental to the other nbagg animation issue just posted. Google led to this post also.)