Matplotlib step-by-step histogram breaks at a value of 10 ^ -1 on xubuntu

Why, when the code is run through python, does the graph seem to split into 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 by passing 10 ** - 1

What it actually looks like:

Broken output

I am currently running python 2.7 on Xubuntu 14.04, and this error occurs on many bar charts. For some reason, when it opens and runs through Python (x, y) on Windows, we get the first histogram (how it should look), but when I switch to python on Xubuntu, all the graphs that I try to run are similar to this , have problems at 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 image to any python version I want to run?

+5
source share
1 answer

This behavior is present in older versions; it is recommended to install a new version.

The output was the same as 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 matplotlib version can be checked with

 python -c 'import matplotlib; print(matplotlib.__version__)' 
+3
source

Source: https://habr.com/ru/post/1240975/


All Articles