October 2018
Beginner to intermediate
676 pages
18h 30m
English
The following code displays two plots for the same input data, but the first one uses default settings so it displays a full range of data on both the x and the y axes, whereas the second plot limits both the x and y axes range:
x = np.linspace(-50,50,500)y = x**2 + np.cos(x)*100
def Num_Format(x, pos): """The two arguments are the number and tick position""" if x >= 1e6: string = '${:1.1f}M'.format(x*1e-6) else: string = '${:1.0f}K'.format(x*1e-3) return string
formatter = FuncFormatter(Num_Format)fig, axs = plt.subplots(1,2, ...
Read now
Unlock full access