美文网首页
matplotlib作图笔记 (1)

matplotlib作图笔记 (1)

作者: 合欢入怀 | 来源:发表于2021-12-08 11:29 被阅读0次

一般作图过程

import numpy as np
import matplotlib.pyplot as plt #import

x=np.linspace(0,10,100) # create data

fig=plt.figure() # create a plot figure
plt.plot(x,np.sin(x),'-r') # plot
plt.show() # show the picture
fig.savefig('figure1.png') # save

主要语法方式有两种:

  • Matlab-style interface image.png image.png
  • Object-oriented interface image.png image.png

    之前没有系统的学习,临到用的时候搜索命令,以致于两种方法混淆,此处澄清。

相关文章

网友评论

      本文标题:matplotlib作图笔记 (1)

      本文链接:https://www.haomeiwen.com/subject/gattfrtx.html