matplotlib_200730系列 5、Annotation标注 一、总结 一句话总结: 1、plt的annotate方法添加标注,plt的text方法添加文本标注 2、虚线用plot方法画,scatter方法来标注点 # 添加标注 # 1、画虚线,也就是两个点 x0=1 y0=2*x0+1 #
转载
2020-07-30 05:01:00
425阅读
2评论
matplotlib_200730系列 4、legend图例 一、总结 一句话总结: 画线中加label表示线的名字,调用legend方法即可显示图例 import matplotlib.pyplot as plt import numpy as np x=np.linspace(-3,3,50)
转载
2020-07-30 03:22:00
121阅读
2评论
matplotlib_200730系列 14、Animation 动画 一、总结 一句话总结: ani=animation.FuncAnimation(fig=fig,func=animate,frames=100,init_func=init,interval=20,blit=False) imp
转载
2020-07-31 06:32:00
102阅读
2评论
matplotlib_200730系列 12、图中图 一、总结 一句话总结: 主要是改变axis的位置:ax1=fig.add_axes([left,bottom,width,height]) # 小图1(主要是改变 left,bottom,width,height) left,bottom,wid
转载
2020-07-31 04:54:00
74阅读
2评论
matplotlib_200730系列 8、image图片 一、总结 一句话总结: plt.imshow(data) 将数值转成颜色 plt.colorbar() 显示颜色基准条 data=np.random.uniform(0,1.0,9).reshape((3,3)) # plt.imshow(
转载
2020-07-30 22:27:00
80阅读
2评论
matplotlib_200730系列 1、figure图像 一、总结 一句话总结: A、不同的figure就是不同的图片 B、figure下面的代码属于这个figure C、plt.figure(num=3, figsize=(8,5)),
转载
2020-07-30 01:49:00
161阅读
2评论
matplotlib_200730系列 11、Subplot 分格显示 一、总结 一句话总结: method 1:subplot2grid:axl=plt.subplot2grid((3,4),(0,0),colspan=4,rowspan=1) method 2:gridspec:gs=grids
转载
2020-07-31 03:29:00
138阅读
2评论
matplotlib_200730系列 13、次坐标轴 一、总结 一句话总结: I、ax2=axl.twinx(); #Create a twin Axes sharing the xaxis II、axl.plot(x,y1,'g-'); ax2.plot(x,y2,'b--'); import
转载
2020-07-31 05:21:00
148阅读
2评论
matplotlib_200730系列 6、Bar 柱状图 一、总结 一句话总结: 柱状图使用非常简单,就是bar方法:plt.bar(X,+Y1,facecolor="#9999ff",edgecolor="white") plt.bar(X,+Y1,facecolor="#9999ff",edg
转载
2020-07-30 05:54:00
147阅读
2评论
matplotlib_200730系列 9、3D数据 一、总结 一句话总结: 画3D图:ax.plot_surface(X,Y,Z,rstride=1,cstride=1,cmap=plt.get_cmap('rainbow')) 画等高线图:ax.contourf(X,Y,Z,zdir='z',o
转载
2020-07-30 22:51:00
126阅读
2评论
转载
2020-07-30 03:09:00
474阅读
2评论
matplotlib_200730系列 10、Subplot 多合一显示 一、总结 一句话总结: plt.subplot(2,2,1):分成2行2列,第1个图:也可以写成 plt.subplot(221) import matplotlib.pyplot as plt plt.figure() #
转载
2020-07-30 23:11:00
111阅读
2评论
matplotlib_200730系列 7、contours 等高线图 一、总结 一句话总结: A、将点放到网格(meshgrid)上面去:X,Y=np.meshgrid(x,y) B、填色:plt.contourf(X,Y,f(X,Y),8, alpha=0.75, cmap=plt.cm.hot
转载
2020-07-30 06:35:00
193阅读
2评论
标准库系列:matplotlib
转载
2021-07-19 11:10:00
106阅读
2评论
文章目录1. 图像在Retina屏幕中显示模糊2. 图像美感问题3. 中文显示乱码4. 全部载入上述设置时,注意载入顺序5. Jupyter notebook图像输出的三种方式一、内联模式:网页直接显示图像二、GUI模式:弹出GUI软件界面显示图像三、内联GUI显示:在网页内显示GUI版图像,结合前两种的好处6. pylab,自动载入numpy和Matplotlibimport matplotlib.pyplot as pltplt.plot([2,3,8,1,5,9])# plt.show()
原创
2022-02-11 10:37:20
919阅读
方法一:在有中文输出的地方,增加一个属性:fontproperties (建议使用)import matplotlib.pyplot as pltimport numpy as npa = np.arange(0.0,5.0,0.02)plt.xlabel('横轴:时间',fontproperties = 'SimHei',fontsize = 20)plt.ylabel('纵轴:振幅',fon
原创
2022-02-23 17:28:44
164阅读
文章目录1. 图像在Retina屏幕中显示模糊2. 图像美感问题3. 中文显示乱码4. 全部载入上述设置时,注意载入顺序5. Jupyter notebook图像输出的三种方式一、内联模式:网页直接显示图像二、GUI模式:弹出GUI软件界面显示图像三、内联GUI显示:在网页内显示GUI版图像,结合前两种的好处6. pylab,自动载入numpy和Matplotlibimport matplotlib.pyplot as pltplt.plot([2,3,8,1,5,9])# plt.show()
原创
2021-06-18 14:34:10
1001阅读
方法一:在有中文输出的地方,增加一个属性:fontproperties (建议使用)import matplotlib.pyplot as pltimport numpy as npa = np.arange(0.0,5.0,0.02)plt.xlabel('横轴:时间',fontproperties = 'SimHei',fontsize = 20)plt.ylabel('纵轴:振幅...
原创
2021-06-18 14:34:12
343阅读
蓝色点表示实际值,红色线段表示上下偏离的误差(相同误差0.6)import matplotlib.pyplot as pltimport numpy as npx=np.linspace(1,10,20)dy=0.6y=np.sin(x)*3plt.errorbar(x,y,yerr=dy,fmt='o',ecolor='r',color='b',elinewidth=2,...
原创
2022-02-21 09:28:44
521阅读
蓝色点表示实际值,红色线段表示上下偏离的误差(相同误差0.6)import matplotlib.pyplot as pltimport numpy as npx=np.linspace(1,10,20)dy=0.6y=np.sin(x)*3plt.errorbar(x,y,yerr=dy,fmt='o',ecolor='r',color='b',elinewidth=2,...
原创
2021-12-30 11:05:31
1507阅读