euclidean.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:cortex 作者: rdevon 项目源码 文件源码
def save_images(self, X, imgfile, density=False):
        ax = plt.axes()
        x = X[:, 0]
        y = X[:, 1]
        if density:
            xy = np.vstack([x,y])
            z = scipy.stats.gaussian_kde(xy)(xy)
            ax.scatter(x, y, c=z, marker='o', edgecolor='')
        else:
            ax.scatter(x, y, marker='o', c=range(x.shape[0]),
                        cmap=plt.cm.coolwarm)

        if self.collection is not None:
            self.collection.set_transform(ax.transData)
            ax.add_collection(self.collection)


        ax.text(x[0], y[0], str('start'), transform=ax.transAxes)
        ax.axis([-0.2, 1.2, -0.2, 1.2])
        fig = plt.gcf()

        plt.savefig(imgfile)
        plt.close()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号