Skip to content

nbagg blit support #4288

@azjps

Description

@azjps

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.)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    pFad - Phonifier reborn

    Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

    Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy