[英]Matplotlib: Change contour/contourf plot levels after plotting
I'm looking for a method to change the levels of a matplotlib contour/contourf plot after it has been plotted, in a way that is similar to the Axes.set_xlim()
or Axes.set_xticks()
methods for example.我正在寻找一种方法来更改 matplotlib 轮廓/轮廓 plot 的水平,其方式类似于
Axes.set_xlim()
或Axes.set_xticks()
方法。 Does anything like this exist?这样的事情存在吗? Thanks
谢谢
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
This doesn't seem possible.这似乎不可能。 There is a
set_array
method that might seem like it would work, but testing it just now doesn't change the levels plotted.有一个
set_array
方法可能看起来可行,但现在测试它并不会改变绘制的级别。 You can always call contourf
again.您可以随时再次调用
contourf
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.