plt.contour 与 plt.contourf

来源:互联网 发布:jquery定义json对象 编辑:程序博客网 时间:2024/05/21 00:17

contour:轮廓,等高线。

  • 为等高线上注明等高线的含义:

    cs = plt.contour(x, y, z)plt.clabel(cs, inline=1, fontsize=10)
  • plt.contourf 与 plt.contour 区别:

    • f:filled,也即对等高线间的填充区域进行填充(使用不同的颜色);
    • contourf:将不会再绘制等高线(显然不同的颜色分界就表示等高线本身),
  • 增加 colorbar;

    cb = plt.colorbar()cb.set_label('meters')

    默认 colorbar 是竖直放置,通过 orientation 关键字参数,可将其设置为水平放置;

    cb = plt.colorbar(orientation='horizontal')
0 0