Module pyspecan.backend.mpl.plot
Classes
class BlitPlot (fig: matplotlib.figure.Figure = <Figure size 640x480 with 0 Axes>)-
Expand source code
class BlitPlot(_Plot): """Plot supporting blitting""" __slots__ = ("_bg", "_cid") def __init__(self, fig: Figure = plt.figure()): super().__init__(fig) for i, ax in enumerate(fig.axes): self._axs[i] = BlitAx(ax, self) self._bg = None self._cid = self._canv.mpl_connect("draw_event", self._on_draw) def update(self): cv = self.canvas fig = cv.figure if self._bg is None: self._on_draw(None) else: cv.restore_region(self._bg) # type: ignore self._draw_animated() # cv.blit(self._fig.bbox) cv.blit(fig.bbox) cv.flush_events() def add_ax(self, name, ax: Axes): self._axs[name] = BlitAx(ax) def _on_draw(self, event): cv = self.canvas if event is not None: if event.canvas != cv: raise RuntimeError self._bg = cv.copy_from_bbox(cv.figure.bbox) # type: ignore self._draw_animated() def _draw_animated(self): for xname, ax in self._axs.items(): for aname, art in ax.artists.items(): # print(f"Drawing {xname}[{aname}]") self._fig.draw_artist(art)Plot supporting blitting
Ancestors
- pyspecan.backend.mpl.plot._Plot
Methods
def add_ax(self, name, ax: matplotlib.axes._axes.Axes)-
Expand source code
def add_ax(self, name, ax: Axes): self._axs[name] = BlitAx(ax)Add new axes
def update(self)-
Expand source code
def update(self): cv = self.canvas fig = cv.figure if self._bg is None: self._on_draw(None) else: cv.restore_region(self._bg) # type: ignore self._draw_animated() # cv.blit(self._fig.bbox) cv.blit(fig.bbox) cv.flush_events()Update plot
class Plot (fig: matplotlib.figure.Figure = <Figure size 640x480 with 0 Axes>)-
Expand source code
class Plot(_Plot): def __init__(self, fig: Figure = plt.figure()): super().__init__(fig) for i, ax in enumerate(fig.axes): self._axs[i] = Ax(ax, self)Generic plotting parent
Ancestors
- pyspecan.backend.mpl.plot._Plot