微信扫一扫打赏支持
摘要: matplotlib_200730系列 10、Subplot 多合一显示 一、总结 一句话总结: plt.subplot(2,2,1):分成2行2列,第1个图:也可以写成 plt.subplot(221) import matplotlib.pyplot as plt plt.figure() # 阅读全文
posted @ 2020-07-30 23:11 范仁义 阅读(135) 评论(0) 推荐(0)
摘要: 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 阅读全文
posted @ 2020-07-30 22:51 范仁义 阅读(100) 评论(0) 推荐(0)
摘要: matplotlib_200730系列 8、image图片 一、总结 一句话总结: plt.imshow(data) 将数值转成颜色 plt.colorbar() 显示颜色基准条 data=np.random.uniform(0,1.0,9).reshape((3,3)) # plt.imshow( 阅读全文
posted @ 2020-07-30 22:27 范仁义 阅读(84) 评论(0) 推荐(0)
摘要: 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 阅读全文
posted @ 2020-07-30 06:35 范仁义 阅读(160) 评论(0) 推荐(0)
摘要: matplotlib_200730系列 6、Bar 柱状图 一、总结 一句话总结: 柱状图使用非常简单,就是bar方法:plt.bar(X,+Y1,facecolor="#9999ff",edgecolor="white") plt.bar(X,+Y1,facecolor="#9999ff",edg 阅读全文
posted @ 2020-07-30 05:54 范仁义 阅读(161) 评论(0) 推荐(0)
摘要: matplotlib_200730系列 5、Annotation标注 一、总结 一句话总结: 1、plt的annotate方法添加标注,plt的text方法添加文本标注 2、虚线用plot方法画,scatter方法来标注点 # 添加标注 # 1、画虚线,也就是两个点 x0=1 y0=2*x0+1 # 阅读全文
posted @ 2020-07-30 05:01 范仁义 阅读(119) 评论(0) 推荐(0)
摘要: matplotlib_200730系列 4、legend图例 一、总结 一句话总结: 画线中加label表示线的名字,调用legend方法即可显示图例 import matplotlib.pyplot as plt import numpy as np x=np.linspace(-3,3,50) 阅读全文
posted @ 2020-07-30 03:22 范仁义 阅读(101) 评论(0) 推荐(0)
摘要: matplotlib_200730系列 3、移动坐标轴 一、总结 一句话总结: 1、get current axis:ax=plt.gca() 2、去掉右轴和上轴,比如去掉右轴:ax.spines['right'].set_color('none') 3、将bottom轴设置为x轴,将left轴设置 阅读全文
posted @ 2020-07-30 03:09 范仁义 阅读(128) 评论(0) 推荐(0)
摘要: matplotlib_200730系列 2、设置x轴、y轴参数 一、总结 一句话总结: plt.xlim((-1,2)):相当于取x轴-1到2的位置 plt.xlabel("x"):设置x轴的文本 plt.xticks(np.linspace(-1,2,5)):替换x轴的标注 # 2、设置x轴 y轴 阅读全文
posted @ 2020-07-30 02:52 范仁义 阅读(263) 评论(0) 推荐(0)
摘要: matplotlib_200730系列 1、figure图像 一、总结 一句话总结: A、不同的figure就是不同的图片 B、figure下面的代码属于这个figure C、plt.figure(num=3, figsize=(8,5)),图像编号是3,图像大小为8,5 二、figure图像 博客 阅读全文
posted @ 2020-07-30 01:49 范仁义 阅读(199) 评论(0) 推荐(0)