plot.py 文件源码

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

项目:sg-mcmc-survey 作者: delta2323 项目源码 文件源码
def visualize2D(fig, ax, xs, ys, bins=200,
                xlabel='x', ylabel='y',
                xlim=None, ylim=None):
    H, xedges, yedges = numpy.histogram2d(xs, ys, bins)
    H = numpy.rot90(H)
    H = numpy.flipud(H)
    Hmasked = numpy.ma.masked_where(H == 0, H)

    ax.pcolormesh(xedges, yedges, Hmasked)

    ax.set_xlabel(xlabel)
    ax.set_ylabel(ylabel)

    if xlim is None:
        xlim = (min(xs), max(xs))
    if ylim is None:
        ylim = (min(ys), max(ys))
    ax.set_xlim(*xlim)
    ax.set_ylim(*ylim)
    fig.colorbar(pyplot.contourf(Hmasked))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号