It seems pyplot.plot
does not align the x and y axes to their respective data endpoints. There are always padded gaps between the plot axes and boundaries and the actual data plot. How can you force a tighter layout for plots such that the plot axes begin and end at their respective terminal data values?
Here's an example of what I mean, with a simple plot:
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(0,101)
plt.plot(x)
As you can see, the plot origin (0,0) and the figure axes origin or intersection (bottom left corner of figure box) are not the same. I want to know how to remove the padding so that the line starting fromx[0]
begins from the bottom left corner of the figure.