use*_*729 13 python matplotlib
由于下面的代码将显示一个没有 的情节plt.show(),有什么意义plt.show()?
请告诉我什么时候plt.show()需要,因为这会让我更好地理解 matplotlib 的复杂性。
注意:我在 Spyder (Anaconda) 中使用这个
import matplotlib.pyplot as plt
plt.subplot(211) # the first subplot in the first figure
plt.plot([1, 2, 3])
Run Code Online (Sandbox Code Playgroud)
Mai*_*Hai 10
需要或不需要取决于您的脚本所在的位置。
有2个上下文。
Matplotlib 用于终端或脚本, plt.show() 是必须的。
Matplotlib 用于 IPython shell 或笔记本(例如:Kaggle),不需要 plt.show()。
| 归档时间: |
|
| 查看次数: |
7105 次 |
| 最近记录: |