当前位置:网站首页>置信区间的画法
置信区间的画法
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')
边栏推荐
- 什么是商业智能(BI),就看这篇文章足够了
- Open3d surface normal vector calculation
- Jerry's ad series MIDI function description [chapter]
- 【LeetCode】17、电话号码的字母组合
- At the right time, the Guangzhou station of the city chain science and Technology Strategy Summit was successfully held
- 迈动互联中标北京人寿保险
- Kubedm initialization error: [error cri]: container runtime is not running
- gtest从一无所知到熟练运用(1)gtest安装
- gtest从一无所知到熟练使用(2)什么是测试夹具/装置(test fixture)
- QT—绘制其他问题
猜你喜欢
Daily question-leetcode556-next larger element iii-string-double pointer-next_ permutation
How to use concurrentlinkedqueue as a cache queue
Flutter TextField示例
[optimtool.unconstrained] unconstrained optimization toolbox
Can be displayed in CAD but not displayed in print
Jerry added the process of turning off the touch module before turning it off [chapter]
迈动互联中标北京人寿保险
QT—双缓冲绘图
ArcGIS 10.2.2 | solution to the failure of ArcGIS license server to start
Redis has three methods for checking big keys, which are necessary for optimization
随机推荐
torch. Tensor and torch The difference between tensor
Flutter 返回按钮的监听
PostgreSQL基本结构——表
Interviewer: what is XSS attack?
每日一题-LeetCode556-下一个更大元素III-字符串-双指针-next_permutation
redis布隆过滤器
Redis has three methods for checking big keys, which are necessary for optimization
改善机器视觉系统的方法
Hash table
Jerry's ad series MIDI function description [chapter]
挖财学院股票开户安全吗?开户只能在挖财开户嘛?
【活动早知道】LiveVideoStack近期活动一览
从RepVgg到MobileOne,含mobileone的代码
Maidong Internet won the bid of Beijing life insurance
超详细教程,一文入门Istio架构原理及实战应用
MYSQL 用!=查询不出等于null的数据,解决办法
Flutter在 release版本,打开后随机白屏不显示内容
MongoDB聚合操作总结
Analyzing the maker space contained in steam Education
哈希表(Hash Tabel)