简体   繁体   English

QQ图以一个图代替9个子图python

[英]Q-Q plot in one figure instead of 9 subplots python

I have a code in which I plot the QQ distribution of nine stocks (iN = 9). 我有一个代码,可以绘制九种股票(iN = 9)的QQ分布图。 So I have one figure with 9 subplots. 所以我有一个有9个子图的人物。 However, I want to have these 9 subplots into one big plot, so one figure. 但是,我想将这9个子图放到一个大图中,所以一个图。 Currently my code is: 目前,我的代码是:

fig, axes = plt.subplots(nrows=6, ncols=2, figsize=(9,20))
ax= axes.flatten()
for i in range(iN):
    sm.qqplot((mY[i,:]), fit = True, line='q', ax=ax[i])
    ax[i].legend(asX2[i])
plt.savefig('NSE_mY_QQplot_norm.jpg', bbox_inches='tight')
plt.show() 

So I changed the code to this: 所以我将代码更改为此:

 fig= plt.figure(figsize=(9,20))
 for i in range(iN):
     sm.qqplot((mY[i,:]), fit = True, line='q', ax=ax[i])
     ax[i].legend(asX2[i])
 plt.savefig('NSE_mY_QQplot_norm.jpg', bbox_inches='tight')
 plt.show()

But then I do not get a figure at all. 但是后来我一点都没有。 Only this note after I run it: 运行后仅此注释:
matplotlib.figure.Figure at 0x1c22325828 matplotlib.figure.Figure at 0x1c22325828

Help is appreciated, thanks!! 感谢帮助,谢谢!

I am two reputation short of being able to comment so I will leave this as an answer. 我是两个无法评论的人,因此我将其作为答案。 A similar question was asked a couple days ago (far after yours) that appears to give the result you wanted: Python: Multiple QQ-Plot 几天前(相距很久),有人问了一个类似的问题,该问题似乎可以提供您想要的结果: Python:多个QQ图

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM