Keb*_*hun 5 python matplotlib python-2.7
为什么当代码通过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")
Run Code Online (Sandbox Code Playgroud)
它实际上是什么样的:
我目前在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__)'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
122 次 |
| 最近记录: |