不推荐使用Python 3 pyplot.hold

2024-05-12 23:49:05 发布

您现在位置:Python中文网/ 问答频道 /正文

我想使用pyplot.hold(True),因为我想在散点图上绘制等高线图。当我使用下面的代码时,它有一个警告:pyplot.hold已被弃用。Python 3中还有其他选项吗?或者我忽略了警告?非常感谢你。

plt.scatter(X[:, 0], X[:, 1], s=150, c='b', 
marker='x', linewidths=1)
plt.hold(True)
plt.contour(X1, X2, Z, np.power(10,(np.arange(-20, 
0.1, 3)).T))
plt.hold(False)

Tags: 代码true警告选项np绘制pltmarker