Q-Q绘图在一个图中而不是9个子图python

问题描述 投票:0回答:1

我有一个代码,其中我绘制了九个股票的Q-Q分布(iN = 9)。所以我有一个有9个子图的图。但是,我希望将这9个子图组合成一个大图,所以一个数字。目前我的代码是:

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() 

所以我把代码更改为:

 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()

但后来我根本得不到一个数字。运行后只有这个注释: matplotlib.figure.Figure at 0x1c22325828

感谢帮助,谢谢!

python matplotlib plot distribution figure
1个回答
0
投票

我有两个声誉,因为我无法发表评论所以我会留下这个作为答案。几天前(远在你的之后)问了一个类似的问题似乎给出了你想要的结果:Python: Multiple QQ-Plot

© www.soinside.com 2019 - 2024. All rights reserved.