本文整理汇总了Python中matplotlib.backends.backend_gtk3agg.FigureCanvasGTK3Agg.restore_region方法的典型用法代码示例。如果您正苦于以下问题:Python FigureCanvasGTK3Agg.restore_region方法的具体用法?Python FigureCanvasGTK3Agg.restore_region怎么用?Python FigureCanvasGTK3Agg.restore_region使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backends.backend_gtk3agg.FigureCanvasGTK3Agg
的用法示例。
在下文中一共展示了FigureCanvasGTK3Agg.restore_region方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ChessAnalogWindow
# 需要导入模块: from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg [as 别名]
# 或者: from matplotlib.backends.backend_gtk3agg.FigureCanvasGTK3Agg import restore_region [as 别名]
#.........这里部分代码省略.........
Gtk.main_quit()
# Oy!
def warn_dialog(self, message):
dialog = Gtk.MessageDialog(self, 0, Gtk.MessageType.WARNING,
Gtk.ButtonsType.OK, "OHNOES!")
dialog.format_secondary_text(message)
response = dialog.run()
# if response == Gtk.ResponseType.OK:
# print "WARN dialog closed by clicking OK button"
dialog.destroy()
def del_px_data(self, d_x):
xpx_old, ypx_old = self.a.transData.transform((0, 0))
xpx_new, ypx_new = self.a.transData.transform((d_x, 0))
return(xpx_new - xpx_old)
def update_plots(self):
if (self.do_redraw):
#print("redraw")
self.a.clear()
self.a.grid(True)
self.canvas.draw()
self.clean_bg = self.canvas.copy_from_bbox(self.f.bbox)
self.background = self.canvas.copy_from_bbox(self.get_bg_bbox(self.a))
self.do_redraw = False
self.a.set_xlim([self.x[-1] - self.fifo_size/SCAN_FREQ - 1, self.x[-1] + 1])
# Restore the blank background
self.canvas.restore_region(self.clean_bg)
xarr = np.array(self.x)
analog_arr = np.array(self.analog_data[0])
analog_arr2 = np.array(self.analog_data[18])
#lastx_ind = np.where(np.array(self.x) > self.lastx)
lastx_ind = np.where(xarr > self.lastx)
#lastx_ind = itertools.islice(self.lastx
#print(lastx_ind[0])
lastx_ind = lastx_ind[0]
# Offset in time
x_offset = abs(xarr[-1] - self.lastx)
# Find the equivalent offset in display pixels
pixel_offset = self.del_px_data(x_offset)
dx_pixel = np.floor(pixel_offset)
# Compute and redraw saved background (moved over).
x1, y1, x2, y2 = self.background.get_extents()
self.canvas.restore_region(self.background,
bbox = (x1 + dx_pixel, y1, x2, y2),
xy = (x1 - dx_pixel, y1))
# if (len(lastx_ind) > 0):
# lastx_ind = np.array(itertools.islice(self.x, lastx_ind[0], self.fifo_size))
# else:
# lastx_ind = np.array(self.x)