I'm trying to eliminate horizontal padding of a Matplotlib plot. Here is the script: import numpy as np, matplotlib.pyplot as plt a = np.random.rand(100) plt.figure(figsize=(12, 6), dpi=100) plt.tight_layout() plt.plot(a) plt.show() The result contains a lot of horizontal padding: I tried this alternative, but the result was the same: import numpy as np, matplotlib.pyplot as plt a = np.random.rand(100) fig, ax = plt.subplots() fig.set_dpi(100) fig.set_size_inches(12, 6) ax.autoscale_view('tight') ax.plot(a) plt.show() Is there a simple solution to this problem? Continue reading...