[英]How to set more automatic levels on contour plot with Matplotlib?
I am plotting the following picture我正在绘制以下图片
with the following code使用以下代码
plt.pcolormesh(ticks[0], ticks[2], np.transpose(potential), zorder=0)
plt.contour(ticks[0], ticks[2], np.transpose(potential), zorder=1, colors='black', linestyles='solid')
plt.pcolormesh(ticks[0], ticks[2], np.transpose(rectangle), cmap=ListedColormap([[1, 1, 1, 0], [0, 0, 0, 1]]), zorder=2)
Now I want more contour levels.现在我想要更多的轮廓层次。 If I code
如果我编码
plt.contour(ticks[0], ticks[2], np.transpose(potential), zorder=1, colors='black', linestyles='solid', levels=100)
(or any other integer) I get the warning (或任何其他整数)我收到警告
/opt/anaconda3/lib/python3.5/site-packages/matplotlib/contour.py:1180: UserWarning: No contour levels were found within the data range.
and picture without contour at all和完全没有轮廓的图片
How to overcome?如何克服?
我要写
plt.contour(ticks[0], ticks[2], np.transpose(potential), 100, zorder=1, colors='black', linestyles='solid')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.