import numpy as np import matplotlib.pyplot as plt #视图 x\y等分越细致,画图越细致 x=np.arange(-100,100,1) y=np.arange(-80,80,1) x,y=np.meshgrid(x,y) z=np.sqrt(x**2+y**2) #画图 #1、创建画布 fig=plt.figure() #分画框,两行两列,标注画框号,1,2,3,4 #编号从左到右,从上到下 ax=fig.add_subplot(221) ax.imshow(z) ax=fig.add_subplot(222) ax.imshow(z,cmap=plt.cm.gray) ax=fig.add_subplot(223) ax.imshow(z,cmap=plt.cm.cool) ax=fig.add_subplot(224) ax.imshow(z,cmap=plt.cm.hot) plt.show()
数据分析~matplotlib.pyplot画布、画图
最新推荐文章于 2022-12-13 16:11:47 发布