如何修复将颤抖与轮廓叠加而损坏的颜色条?

时间:2019-03-10 15:15:05

标签: python-3.x matplotlib plot heatmap contour

我制作了一个绘图仪函数,该函数接受列表和值并对它们进行绘图。颤抖最初设置为false;并且如果要在轮廓上覆盖颤动图,则将其设置为true。

def plotter(x_axis, y_axis, cbar, int_pol, cmap=colorMap, quiver=False)
    plt.contourf(x_axis, y_axis, cbar, int_pol, cmap=colorMap)
    cbar = plt.colorbar()
    if quiver:
        E0 = np.gradient(cbar)
        E = E0/np.sqrt(E0[0]**2 + E0[1]**2)
        plt.quiver(x_axis, y_axis, E[1], E[0])

但是,在我上面的代码中,似乎用等高线(没有颜色条)覆盖颤动并仅绘制等高线(这会产生颜色条)效果很好,但是当我同时覆盖这两个颜色条时,就会破坏屏幕上的颜色条。

enter image description here

enter image description here

enter image description here

0 个答案:

没有答案