Python 画图:在同一张图上画两次,怎样执行?
PHP中文网
PHP中文网 2017-04-17 14:53:06
0
1
3262

如题。
Matlab中,执行一次plot后,用语句hold on
然后再plot,两次画图即在一张图上。

在Python中,matplotlib.pyplot或者更多程序包,怎样实现?
多次plot,在同一张图上?

PHP中文网
PHP中文网

认证0级讲师

reply all(1)
刘奇

matplotlib is almost the same as Matlab, and does not require a hold on statement. For example

import matplotlib.pyplot as plt

x = range(10)
y1 = [elem*2 for elem in x]
plt.plot(x, y1)

y2 = [elem**2 for elem in x]
plt.plot(x, y2, 'r--')

plt.show()
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template