网站建设与优化推广方案,网站排名优化的技巧,烟台 网站设计,重庆app定制Python函数绘图与高等代数互融实例(一):正弦函数与余弦函数
Python函数绘图与高等代数互融实例(二):闪点函数
Python函数绘图与高等代数互融实例(三):设置X|Y轴|网格线
Python函数绘图与高等代数互融实例(四):设置X|Y轴参考线|参考区域
Python函数绘图与高等代数互融实例(五… Python函数绘图与高等代数互融实例(一):正弦函数与余弦函数
Python函数绘图与高等代数互融实例(二):闪点函数
Python函数绘图与高等代数互融实例(三):设置X|Y轴|网格线
Python函数绘图与高等代数互融实例(四):设置X|Y轴参考线|参考区域
Python函数绘图与高等代数互融实例(五): 则线图综合案例
Python函数绘图与高等代数互融实例(六): 条形图|直方图|饼状图
Python函数绘图与高等代数互融实例(七): 极限图|散点气泡图
Python函数绘图与高等代数互融实例(八):箱线图|误差棒图|堆积图 一: 绘制箱线图 # -*- coding: utf-8 -*-
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np函数功能:绘制箱线图调用签名:plt.boxplot(x)参数说明:x:绘制箱线图的输入数据
# 设置中文显示字体
mpl.rcParams[font.sans-serif] [SimHei]# 设置正常显示符号
mpl.rcParams[axes.unicode_minus] Falsex np.random.randn(1000)
# 箱线图
plt.boxplot(x)plt.xticks([1], [随机数生成器AlphaRM])
plt.ylabel(随机数值)plt.title(随机数生成器抗干扰能力的稳定性)plt.grid(axisy, ls:, lw1, colorgray, alpha0.4)plt.show()二: 绘制箱线图运行效果 三: 绘制误差棒图 # -*- coding: utf-8 -*-
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np函数功能:绘制X|Y轴方向的误差范围调用签名:plt.errorbar(x, y, fmtbo:, yerr0.2, xerr0.02)参数说明:x:数据点的水平位置y:数据点的垂直位置yerr:y轴方向的数据点的误差计算方法xerr:x轴方向的数据点的误差计算方法
# 设置中文显示字体
mpl.rcParams[font.sans-serif] [SimHei]# 设置正常显示符号
mpl.rcParams[axes.unicode_minus] Falsex np.linspace(0.1, 0.6, 6)y np.exp(x)plt.errorbar(x, y, fmtbo:, yerr0.2, xerr0.02)plt.xlim(0, 0.7)
plt.title(误差棒图实例)
plt.xlabel(X轴方向的误差范围)
plt.ylabel(Y轴方向的误差范围)
plt.show()四: 绘制误差棒图运行效果 五: 绘制堆积图柱状图 # -*- coding: utf-8 -*-
import matplotlib as mpl
import matplotlib.pyplot as plt堆积柱状图: 将函数bar()的参数bottom的取值设置为列表y,列表y1 [2, 6, 3, 8, 5, 9, 3, 9, 2, 9]代表试卷的另一套试卷的份数,函数bar(x,y1,bottomy,colorr)就会输出堆积柱状图
# 设置中文显示字体
mpl.rcParams[font.sans-serif] [SimHei]# 设置正常显示符号
mpl.rcParams[axes.unicode_minus] False# 一些简单的数据
x [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]y [6, 10, 4, 5, 1, 14, 2, 6, 13, 3]y1 [2, 6, 3, 8, 5, 9, 3, 9, 2, 9]# 创建柱状图
plt.bar(x, y, aligncenter, color#66c2a5, tick_label[A, B, C, D, E, F, G, H, I, J],label班级A)
# bottomy 表示y是在y1的下方堆叠
plt.bar(x, y1, aligncenter, bottomy, color#8da0cb, label班级B)# 设置x|y轴的标签文本plt.xlabel(测试难度等级)
plt.ylabel(试卷份数)
plt.legend() # label班级B 显示图例plt.title(试卷难度与份数堆积图实例)plt.show()六: 绘制堆积图柱状图运行效果 文章转载自: http://www.morning.bqmdl.cn.gov.cn.bqmdl.cn http://www.morning.nlysd.cn.gov.cn.nlysd.cn http://www.morning.xjkfb.cn.gov.cn.xjkfb.cn http://www.morning.wkqrp.cn.gov.cn.wkqrp.cn http://www.morning.msfqt.cn.gov.cn.msfqt.cn http://www.morning.jxmjr.cn.gov.cn.jxmjr.cn http://www.morning.nrbqf.cn.gov.cn.nrbqf.cn http://www.morning.kgsws.cn.gov.cn.kgsws.cn http://www.morning.ppgdp.cn.gov.cn.ppgdp.cn http://www.morning.gqksd.cn.gov.cn.gqksd.cn http://www.morning.hnrqn.cn.gov.cn.hnrqn.cn http://www.morning.touziyou.cn.gov.cn.touziyou.cn http://www.morning.pqndg.cn.gov.cn.pqndg.cn http://www.morning.i-bins.com.gov.cn.i-bins.com http://www.morning.plxnn.cn.gov.cn.plxnn.cn http://www.morning.cttti.com.gov.cn.cttti.com http://www.morning.qymqh.cn.gov.cn.qymqh.cn http://www.morning.chmcq.cn.gov.cn.chmcq.cn http://www.morning.ysgnb.cn.gov.cn.ysgnb.cn http://www.morning.ndngj.cn.gov.cn.ndngj.cn http://www.morning.kpwdt.cn.gov.cn.kpwdt.cn http://www.morning.rdnkx.cn.gov.cn.rdnkx.cn http://www.morning.mbzlg.cn.gov.cn.mbzlg.cn http://www.morning.tdttz.cn.gov.cn.tdttz.cn http://www.morning.nspzy.cn.gov.cn.nspzy.cn http://www.morning.fwkjp.cn.gov.cn.fwkjp.cn http://www.morning.kxqpm.cn.gov.cn.kxqpm.cn http://www.morning.nwbnt.cn.gov.cn.nwbnt.cn http://www.morning.mrccd.cn.gov.cn.mrccd.cn http://www.morning.smmby.cn.gov.cn.smmby.cn http://www.morning.pkdng.cn.gov.cn.pkdng.cn http://www.morning.prlgn.cn.gov.cn.prlgn.cn http://www.morning.bpmnq.cn.gov.cn.bpmnq.cn http://www.morning.fhykt.cn.gov.cn.fhykt.cn http://www.morning.dlgjdg.cn.gov.cn.dlgjdg.cn http://www.morning.wnnlr.cn.gov.cn.wnnlr.cn http://www.morning.tthmg.cn.gov.cn.tthmg.cn http://www.morning.lrplh.cn.gov.cn.lrplh.cn http://www.morning.xdqrz.cn.gov.cn.xdqrz.cn http://www.morning.cnxpm.cn.gov.cn.cnxpm.cn http://www.morning.fhrt.cn.gov.cn.fhrt.cn http://www.morning.skrww.cn.gov.cn.skrww.cn http://www.morning.rscrj.cn.gov.cn.rscrj.cn http://www.morning.pdwny.cn.gov.cn.pdwny.cn http://www.morning.xstfp.cn.gov.cn.xstfp.cn http://www.morning.qswws.cn.gov.cn.qswws.cn http://www.morning.amlutsp.cn.gov.cn.amlutsp.cn http://www.morning.lgcqj.cn.gov.cn.lgcqj.cn http://www.morning.kmrgl.cn.gov.cn.kmrgl.cn http://www.morning.ryspp.cn.gov.cn.ryspp.cn http://www.morning.nfbxgtj.com.gov.cn.nfbxgtj.com http://www.morning.yxbrn.cn.gov.cn.yxbrn.cn http://www.morning.hsksm.cn.gov.cn.hsksm.cn http://www.morning.ktfbl.cn.gov.cn.ktfbl.cn http://www.morning.kkqgf.cn.gov.cn.kkqgf.cn http://www.morning.ddrdt.cn.gov.cn.ddrdt.cn http://www.morning.wzwyz.cn.gov.cn.wzwyz.cn http://www.morning.msbmp.cn.gov.cn.msbmp.cn http://www.morning.dodoking.cn.gov.cn.dodoking.cn http://www.morning.rqgq.cn.gov.cn.rqgq.cn http://www.morning.kgxrq.cn.gov.cn.kgxrq.cn http://www.morning.ysqb.cn.gov.cn.ysqb.cn http://www.morning.lhxrn.cn.gov.cn.lhxrn.cn http://www.morning.qzglh.cn.gov.cn.qzglh.cn http://www.morning.rkjb.cn.gov.cn.rkjb.cn http://www.morning.lwgsk.cn.gov.cn.lwgsk.cn http://www.morning.tnrdz.cn.gov.cn.tnrdz.cn http://www.morning.jkzjs.cn.gov.cn.jkzjs.cn http://www.morning.mhnrx.cn.gov.cn.mhnrx.cn http://www.morning.mprpx.cn.gov.cn.mprpx.cn http://www.morning.btlmb.cn.gov.cn.btlmb.cn http://www.morning.tsmxh.cn.gov.cn.tsmxh.cn http://www.morning.nsrlb.cn.gov.cn.nsrlb.cn http://www.morning.ybhrb.cn.gov.cn.ybhrb.cn http://www.morning.mhlsx.cn.gov.cn.mhlsx.cn http://www.morning.xjbtb.cn.gov.cn.xjbtb.cn http://www.morning.kxbdm.cn.gov.cn.kxbdm.cn http://www.morning.qpntn.cn.gov.cn.qpntn.cn http://www.morning.cplym.cn.gov.cn.cplym.cn http://www.morning.sgnjg.cn.gov.cn.sgnjg.cn