def __init_animation(self):
masked_array = np.ma.array(self.frames[0], mask=np.isinf(self.frames[0]))
vmin = 0
vmax = np.max(np.ma.array(self.frames[-1], mask=np.isinf(self.frames[-1])))
from mpl_toolkits.axes_grid1 import make_axes_locatable
div = make_axes_locatable(self.ax2)
cax = div.append_axes('right', '5%', '5%')
cax.axis('off')
div = make_axes_locatable(self.ax3)
cax = div.append_axes('right', '5%', '5%')
self.img = self.ax3.imshow(masked_array, interpolation='nearest', vmin=vmin, vmax=vmax, alpha=0.7)
if self.matrix_labels:
self.lables = self.__plot_matrix_labels(self.frames[0], self.ax3)
else:
self.lables = []
self.fig.colorbar(self.img, cax=cax)
self.active_cells.append(self.ax3.add_patch(
patches.Rectangle((0, 0), 1, 1, fill=False, linestyle='--', color='k', linewidth=3)
))
self.active_cells.append(self.ax3.add_patch(
patches.Rectangle((0, 0), 1, 1, fill=False, linestyle='--', color='k', linewidth=3)
))
self.active_cells.append(self.ax3.add_patch(
patches.Rectangle((0, 0), 1, 1, fill=False, linestyle='-', color='k', linewidth=3)
))
return self.lables + [self.img]
评论列表
文章目录