CrossPlot.py 文件源码

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

项目:GRIPy 作者: giruenf 项目源码 文件源码
def create_xy_pdf(self, where=None, color=None):
        if where is None:
            where = self.good
        if color is None:
            color = '#bbbbbb'

        xmin, xmax = self.xlim
        ymin, ymax = self.ylim

        X, Y = np.mgrid[xmin:xmax:100j, ymin:ymax:100j]

        positions = np.vstack([X.ravel(), Y.ravel()])
        values = np.vstack([self.x[where], self.y[where]])
        xy_kde = stats.gaussian_kde(values)
        xy_pdf = np.reshape(xy_kde(positions), X.shape)

        """
        vmin = np.nanmin(xy_pdf)
        vmax = np.nanmax(xy_pdf)
        cmap = matplotlib.cm.gray_r
        xy_pdf = self.crossplot_ax.contourf(X, Y, xy_pdf, 20, cmap=cmap,
                                            vmin=vmin, vmax=2*vmax, alpha=alpha,
                                            zorder=-2)
        """
        xy_pdf = self.crossplot_ax.contour(X, Y, xy_pdf, 5, colors=color[:3],
                                           alpha=color[-1], zorder=-2)
        #"""
        self.xy_pdfs.append(xy_pdf)

        self.crossplot_ax.set_xlim(*self.xlim)
        self.crossplot_ax.set_ylim(*self.ylim)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号