Matplotlib hist'stepfilled'因为在子批中共享时y轴限制错误

2024-09-30 08:17:42 发布

您现在位置:Python中文网/ 问答频道 /正文

这是虫子吗?你知道吗

x = np.array([ 818711.1744542 ,  669773.03634965,  543356.09981887,
        470591.70414664,  714122.36408414,  217738.75076945,
         28745.17458754,  141449.75133332,  615191.6898459 ,
        670313.87408492,  172659.79727241,  527118.36469071,
        681758.92137939,  501650.40878561,  589137.36287002,
        739322.65014892,  971689.73156403,  979982.50933109,
        443309.27379687,  825545.12523484,  977570.12881254,
        482373.00247962,  585267.80697022,  917603.9250595 ,
        827764.28771029,  795593.20948158,  838415.94002771,
        664440.79658276,  903914.91015934,  734159.13190169,
        170773.05027415,  685732.01672126,  963802.50545491,
        945871.36264578,  946092.816821  ,  978555.6989711 ,
        609820.6001542 ,  630930.19311344,  558443.3287544 ,
        825938.05790564,  868753.63230453,  409611.12216198,
        734786.62824111,  863529.34276256,  831165.49030936,
        889864.544662  ,  268155.54327948,  814819.39399194,
        170339.98153606,   77990.18800948,  508010.80471703,
        287091.0945269 ,  697898.61498747,  764004.15763691,
        361015.59119081,  504435.78829914,  319638.57795959,
        847640.28715912,  543362.66737219,  896885.63266957,
        439985.97450769,  600850.25663362,  818312.37674795])

因此,如果执行“stepfilled”,x limit设置为[0,30000]

fig, ax = plt.subplots(2, sharey=True)
ax[0].hist(x, bins=50, histtype='stepfilled');
ax[1].hist(x, bins=50, histtype='stepfilled');

enter image description here

不过,如果我用其他方法,它是好的。你知道吗

fig, ax = plt.subplots(2, sharey=True)
ax[0].hist(x, bins=50, histtype='bar');
ax[1].hist(x, bins=50, histtype='stepfilled');

enter image description here


Tags: 方法truenpfigpltaxarrayhist

热门问题