我们从Python开源项目中,提取了以下5个代码示例,用于说明如何使用matplotlib.pyplot.spy()。
def getError(self): if plotIt: plt.spy(self.getAve(self.M)) plt.show() num = self.getAve(self.M) * self.getHere(self.M) err = np.linalg.norm((self.getThere(self.M)-num), np.inf) if plotIt: self.M.plotImage(self.getThere(self.M)-num) plt.show() plt.tight_layout return err
def getError(self): if plotIt: plt.spy(self.getAve(self.M)) plt.show() num = self.getAve(self.M) * self.getHere(self.M) err = np.linalg.norm((self.getThere(self.M)-num), np.inf) return err
def plot_Phis_sparsity(self, Phis, fig=0): Phis = [phis[0].data.cpu().numpy() for phis in Phis] plt.figure(fig) plt.clf() for i, phi in enumerate(Phis): plt.subplot(1, len(Phis), i + 1) # plot first element of the batch plt.spy(phi, precision=0.001, marker='o', markersize=2) plt.xticks([]) plt.yticks([]) plt.title('k={}'.format(i)) path = os.path.join(self.path, 'Phis.png') plt.savefig(path)