文章目录
From PythonDataScienceHandbook
4.0
style
plt.style.use('...')
show
在 .py
文件中,plt.show()
应该在脚本的结尾处,且只出现一次,否则会有不可预料的结果。
save figure
fig = plt.figure()
...
fig.savefig('my_figure.png')
show the save figure
from IPython.display import Image
Image('my_figure.png')
object-oriented interface
fig, ax = plt.subplots(2)
这里 fig 和 ax 是数组,可以通过 index 取到对应的 axes (坐标系)
4.1 Simple Line Plot
ax.***
API is simi