【问题标题】:Matplotlib: Change contour/contourf plot levels after plottingMatplotlib:绘图后更改轮廓/轮廓绘图级别
【发布时间】:2020-12-11 00:02:56
【问题描述】:

我正在寻找一种在绘制 matplotlib 等高线/等高线图后更改其级别的方法,其方式类似于 Axes.set_xlim()Axes.set_xticks() 方法。这样的事情存在吗? 谢谢

fig = Figure()
ax = fig.add_subplot(111)

# Create plot with automatic levels
ax.contourf(x, y, z)

# Change levels
levels = [0,1,2,3,4,5]
ax.set_levels(levels)                 # <------ Type of method I am looking for 

【问题讨论】:

  • 不存在。
  • 这样做没有任何好处,反正轮廓需要重新计算,所以你干脆删除轮廓再调用contourf就好了。

标签: python matplotlib contour contourf


【解决方案1】:

这似乎是不可能的。有一个set_array 方法可能看起来可行,但现在测试它并不会改变绘制的水平。您可以随时再次拨打contourf

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-07-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-07-30
    • 1970-01-01
    • 2021-09-07
    • 1970-01-01
    相关资源
    最近更新 更多