(1)函数subplot()绘制网格区域中的几何形状相同的子区布局 import matplotlib.pyplot as plt import numpy as np '''函数subplot的介绍:函数 subplot(numEows, numCols, plotNum) 或者subplot(CRN),CRN的含义是将画布 分成C行R列,该子区被放在第N个位置上 ''' x = np.linspace(-2*np.pi, 2*np.pi, 200) y = np.sin(x) y1 = np…
  1.使用函数绘制matplotlib的图表组成元素 (1)函数plot---变量的变化趋势 import matplotlib.pyplot as plt import numpy as np x = np.linespace(0.05, 10, 1000) #在x轴均匀取1000个点 y = np.cos(x) #对应的y值 plt.plot(x,y,ls="-", lw=2, label="plot figure") ''' ls-------->线条…
(1)共享单一绘图区域的坐标轴 ''' 上一讲介绍了画布的划分,有时候想将多张图放在同一个绘图区域, 不想在每个绘图区域只绘制一幅图形,这时候借助共享坐标轴的方法实现在一个绘图区 绘制多幅图形的目的. ''' import matplotlib.pyplot as plt import numpy as np import matplotlib as mpl mpl.rcParams["font.sans-serif"]=["SimHei"] mpl.rcParam…
(一)设置坐标轴的位置和展示形式 (1)向画布中任意位置添加任意数量的坐标轴 ''' 通过在画布的任意位置和区域,讲解设置坐标轴的位置和坐标轴的展示形式的实现方法, 与subplot,subplots不同,axes可以完成子区的交错,覆盖和重叠等视图组合 ax(rect, frameon, facecolor)的参数的含义 rect=[left, bottom, width, height] left------------>左侧边缘距离画布边缘的距离 bottom---------->距离底…
(一)刻度线定位器和刻度格式器的使用方法 import matplotlib.pyplot as plt import numpy as np from matplotlib.ticker import AutoMinorLocator, MultipleLocator, FuncFormatter x = np.linspace(0.5, 3.5, 100) y = np.sin(x) fig = plt.figure(figsize=(8, 8)) #生成8x8的画布 ax = fig.ad…
(一)再说legend() import matplotlib.pyplot as plt import numpy as np x = np.arange(0, 2.1, 0.1) y = np.power(x, 3) y1 = np.power(x, 2) y2 = np.power(x,1) plt.plot(x, y, ls="-", lw=2, label="$x^{3}$") plt.plot(x, y1, ls="-", lw=2,…
1. subplot() 绘制网格区域中几何形状相同的子区布局 函数签名有两种: subplot(numRows, numCols, plotNum) subplot(CRN) 都是整数,意思是将画布划分为C行R列个子区,此时定位到第N个子区上,子区编号按照行优先排序. 下面就是最喜爱的举例环节 [Example 1] import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl mpl.use('Qt5A…
什么是序列? 就是每一个元素被有序的排成一列 什么是序列化? 就是将原本的列表.字典等内容转化成字符串的过程 什么时候会用到序列化? 数据存储(把数据放在文件.数据库),网络传输等 序列化的目的 1.以某种存储形式使自定义对象持久化 2.将对象从一个地方传递到另一个地方 3.使程序更具维护性 序列化:数据结构转换成字符串 反序列化:字符串转换成数据结构 三大序列化模块: 1.Json 特点: json是一个通用的序列化格式且只有很少一部分数据(str.list.dict.tuple.数字)类型能…
(一)误差棒图----误差置信区间的表示 import matplotlib.pyplot as plt import numpy as np x = np.linspace(0.1, 0.6, 10) y = np.exp(x) error = 0.05 + 0.15*x lower_error = error upper = 0.3*error error_limit = [lower_error, upper] plt.errorbar(x, y, yerr=error_limit, fm…
(一)箱线图---由一个箱体和一对箱须组成,箱体是由第一个四分位数,中位数和第三四分位数组成,箱须末端之外的数值是离散群,主要应用在一系列测量和观测数据的比较场景 import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np mpl.rcParams["font.sans-serif"] = ["FangSong"] mpl.rcParams["axes.unicod…