当前位置:网站首页>置信区间的画法
置信区间的画法
2022-07-04 21:14:00 【小蜗笔记】
err_inter = result.conf_int()
#置信区间的中心
err_mean = (err_inter[1]+err_inter[0])/2
# 置信区间的长度
err_long = (err_inter[1]-err_inter[0])/2
#置信区间画图
import matplotlib.pyplot as plt
from scipy import stats
import numpy as np
plt.style.use('seaborn-whitegrid')
fig, ax = plt.subplots(figsize=(50, 20),dpi=60)
ax.spines['bottom'].set_linewidth('2.0')#设置边框线宽为2.0
ax.spines['bottom'].set_color('black')
ax.spines['top'].set_linewidth('2.0')#设置边框线宽为2.0
ax.spines['top'].set_color('black')
ax.spines['right'].set_linewidth('2.0')#设置边框线宽为2.0
ax.spines['right'].set_color('black')
ax.spines['left'].set_linewidth('2.0')#设置边框线宽为2.0
ax.spines['left'].set_color('black')
plt.xticks(fontsize = 50)
plt.yticks(fontsize = 50)
for i in range(1,len(err_inter)):
ax.errorbar(i-10,err_mean[i] , yerr=err_long[i],
fmt='.', markersize=10, capsize=15, color='black')
xticks = [-9,-8, -7, -6, -5, -4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11]
xticklabes =['-9','-8','-7','-6','-5','-4','-3','-2','-1','0','1','2','3','4','5','6','7','8','9','10','11']
plt.xticks(xticks,xticklabes,size=50)
yticks = [-2,-1,0,1,2,3,4,5]
yticklabes =['-2','-1','0','1','2','3','4','5']
ax.plot([-9.5,11.5],[0,0], color='black',linestyle = '--',linewidth=2, markersize=12)
plt.xticks(xticks,xticklabes,size=50)
ax.set_ylim(-2.5, 5.5)
ax.set_xlim(-9.5, 11.5)
#ax.fill_betweenx([1, 0], facecolor='lightgrey', alpha=0.3)
#ax.legend(loc='best', fontsize=11, framealpha=1, frameon=True)
#ax.set_xticklabels()
#ax.set_ticklabels()
#ax.set_yticklabels(labels=labels)
ax.set_xlabel('time', fontsize=50)
ax.set_ylabel('coefficient', fontsize=50)
#ax.yaxis.set_major_formatter(plt.NullFormatter())
#fig.tight_layout();
#plt.show()
#plt.savefig(r'C:\Users\sc35131\Desktop\wangyao\Cell_consistence_alogrithm\picture9\\'+'1234',bbox_inches = 'tight',pad_inches = 0,dpi =350)
plt.savefig('平行趋势检验.png')
边栏推荐
- redis事务
- MongoDB中的索引操作总结
- Cloudcompare & open3d DBSCAN clustering (non plug-in)
- Operation of adding material schedule in SolidWorks drawing
- __ init__ () missing 2 required positive arguments
- Redis bloom filter
- 如何使用ConcurrentLinkedQueue做一个缓存队列
- TCP shakes hands three times and waves four times. Do you really understand?
- GTEST from ignorance to skillful use (1) GTEST installation
- TCP三次握手,四次挥手,你真的了解吗?
猜你喜欢
MP3是如何诞生的?
[ 每周译Go ] 《How to Code in Go》系列文章上线了!!
Analysis of maker education technology in the Internet Era
How to remove the black dot in front of the title in word document
Maya lamp modeling
【活动早知道】LiveVideoStack近期活动一览
Daily question-leetcode556-next larger element iii-string-double pointer-next_ permutation
How was MP3 born?
创客思维在高等教育中的启迪作用
Bookmark
随机推荐
Jerry added the process of turning off the touch module before turning it off [chapter]
Jerry's ad series MIDI function description [chapter]
__ init__ () missing 2 required positive arguments
巅峰不止,继续奋斗!城链科技数字峰会于重庆隆重举行
redis布隆过滤器
numpy vstack 和 column_stack
Daily question-leetcode556-next larger element iii-string-double pointer-next_ permutation
Enlightenment of maker thinking in Higher Education
Use of class methods and class variables
Arcgis 10.2.2 | arcgis license server无法启动的解决办法
Master the use of auto analyze in data warehouse
Hash table
How much is the minimum stock account opening commission? Is it safe to open an account online
Methods of improving machine vision system
Le module minidom écrit et analyse XML
[early knowledge of activities] list of recent activities of livevideostack
每日一题-LeetCode1200-最小绝对差-数组-排序
Can be displayed in CAD but not displayed in print
Exclusive interview of open source summer | new committer Xie Qijun of Apache iotdb community
Redis pipeline