How to prevent numbers being changed to exponential form in a plot

The formatting of tick labels is controlled by a Formatter object, which assuming you haven’t done anything fancy will be a ScalerFormatterby default. This formatter will use a constant shift if the fractional change of the values visible is very small. To avoid this, simply turn it off: plt.plot(arange(0,100,10) + 1000, arange(0,100,10)) ax = plt.gca() … Read more

What are the differences between add_axes and add_subplot?

Common grounds Both, add_axes and add_subplot add an axes to a figure. They both return a (subclass of a) matplotlib.axes.Axes object. However, the mechanism which is used to add the axes differs substantially. add_axes The calling signature of add_axes is add_axes(rect), where rect is a list [x0, y0, width, height] denoting the lower left point … Read more

How do I tell Matplotlib to create a second (new) plot, then later plot on the old one?

If you find yourself doing things like this regularly it may be worth investigating the object-oriented interface to matplotlib. In your case: import matplotlib.pyplot as plt import numpy as np x = np.arange(5) y = np.exp(x) fig1, ax1 = plt.subplots() ax1.plot(x, y) ax1.set_title(“Axis 1 title”) ax1.set_xlabel(“X-label for axis 1”) z = np.sin(x) fig2, (ax2, ax3) … Read more

tech