August 2017
Beginner to intermediate
334 pages
8h 22m
English
Alternatively, pyplot.loglog() can be used to make a plot with log scaling on both the x and y axes instead of specifying the scale after running pyplot.plot(). In the following complete example, we are going to combine the use of tick formatters to display the y axis in natural log scale, as well as the use of keyword argument basex to display the x axis in log2 scale:
import numpy as npimport matplotlib.pyplot as pltfrom matplotlib.ticker import FuncFormatterdef ticks(y, pos): """ Method that formats the axis labels to natural log scale """ # Use Python string formatter to limit the number of decimal places # for float values. # The precision of the formatted float value can be specified using # a full stop, followed ...
Read now
Unlock full access