figure图形,画的每个图只有一个figure对象
x= np.arange(-3,3,0.1)
y1=np.sin(x)
#创建第一个figure
plt.figure()
#绘图
plt.plot...image.png
创建子图
在一个figure中显示多个图片
面向过程的方法,一步一步创建
x1=[1,2,3]
y1=[5,7,4]
x2=[1,2,3]
y2=[10,14,12]
plt.figure...()
plt.subplot(221)#第一个子图
plt.plot(x1,y1,'ro--')
plt.subplot(223)
plt.plot(x2,y2,'bo-')#第二个子图
plt.show...面向对象创建子图
#创建图形
fig=plt.figure()
#创建子图
ax1=fig.add_subplot(221)
ax2=fig.add_subplot(222)
ax3=fig.add_subplot...image.png
后记:
线图先到这,还有柱状图,散点图,3d图等待续……
你可能感冒的文章:
我的机器学习numpy篇
我的机器学习pandas篇
我的机器学习微积分篇