matplotlib add space between subplots code example

Example 1: matplotlib space between subplots

import matplotlib.pyplot as plt
matplotlib.pyplot.subplots_adjust(wspace=X, hspace=Y)
# Adjust X for width between subplots
# Adjust Y for height between subplots

Example 2: matplotlib add space between subplots

import matplotlib.pyplot as plt

fig, axes = plt.subplots(nrows=4, ncols=4)
fig.tight_layout() # Or equivalently,  "plt.tight_layout()"

plt.show()

Example 3: how to increase distance between subplot matplot lib

subplots_adjust(left=None, bottom=None, right=None, top=None, wspace=None, hspace=None)

Tags:

Misc Example