Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

matplotlib stepfilled histogram breaks at the value 10^-1 on xubuntu

Why is it that when the code is run through python the graph seems to break down at 10^-1 on the y-axis?(Code below)

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

What it should look like: Correct image stepping past 10**-1

What it actually looks like:

Broken output

I am currently running python 2.7 on Xubuntu 14.04, and this error happens on many histograms. For some reason when opened and run through Python(x,y) on Windows we get the first histogram(What it should look like) but when I move onto python on Xubuntu all the graphs I try to run similar to this one all have issues at the 10^-1 on the y-axis.(What it actually looks like) What can I do with this code to make sure it outputs the first gyazo picture on any python version I want to run?

like image 376
Kebur Fantahun Avatar asked Oct 18 '22 17:10

Kebur Fantahun


1 Answers

This behaviour is present in older versions, installing a new version is recommended.

The output was as excepted with python 2.7 and matplotlib 1.4.2 (debian / jessie), but not with python 2.7 and matplotlib 1.3.1 (xubuntu 14.04 / trusty).

The version of the matplotlib can be checked with

python -c 'import matplotlib; print(matplotlib.__version__)'
like image 92
J.J. Hakala Avatar answered Nov 02 '22 11:11

J.J. Hakala