August 2017
Beginner to intermediate
334 pages
8h 22m
English
As you can see from the previous example, the line appears to be completely flat due to the presence of a single outlier point.
A logarithmic scale is one of the most widely used nonlinear scales. Suppose there is a series of values, where each value equals the previous value multiplied by a constant factor; they can be represented by equidistant ticks on the logarithmic scale. Therefore, the distance from 1 to 2 is equivalent to that from 2 to 4, or 4 to 8.
Matplotlib uses base 10 as the default for logarithmic scale. As a quick reminder of math, log corresponds to the exponent. For example, log10(100) = log10(102) = 2.
This can be done by calling pyplot.yscale() before pyplot.show():
#Change y-axis to log10 scaleplt.yscale('log') ...Read now
Unlock full access