为什么当代码通过 python 运行时,图形似乎在 y 轴上的 10^-1 处分解?(下面的代码)
from pylab import *
bins = [+0.000e+00,+1.000e+00,+2.000e+00,+3.000e+00,+4.000e+00,+5.000e+00]
wght = [[+3.000e-02,+7.0e-02,+3.0e-01,+5.0e-01,+8.0e-01]]
hist([ bins[:-1] for i in range(len(wght)) ], bins=bins, weights=wght,histtype="stepfilled", log=True )
ylim(bottom=0.01); ylim(top=1.0)
savefig("./output.pdf")
实际情况:
我目前在 Xubuntu 14.04 上运行 python 2.7,这个错误发生在许多直方图上。出于某种原因,当在 Windows 上打开并通过 Python(x,y) 运行时,我们得到了第一个直方图(它应该是什么样子)但是当我在 Xubuntu 上使用 python 时,我尝试运行的所有图表都与此类似,但都有问题在 y 轴的 10^-1 处。(它实际看起来像什么)我可以用这段代码做什么来确保它在我想运行的任何 python 版本上输出第一张 gyazo 图片?
最佳答案
此行为存在于旧版本中,建议安装新版本。
输出与 python 2.7 和 matplotlib 1.4.2 (debian/jessie) 相同,但与 python 2.7 和 matplotlib 1.3.1 (xubuntu 14.04/trusty) 不同。
matplotlib 的版本可以用
python -c 'import matplotlib; print(matplotlib.__version__)'
关于python - matplotlib stepfilled 直方图在 xubuntu 的值 10^-1 处中断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34891156/