9951 explained code solutions for 126 technologies


python-matplotlibHow to set more space between subplots


Use subplots_adjust() method to set subplots spacing:

import matplotlib.pyplot as plt

fig, axes = plt.subplots(nrows=1, ncols=2)

axes[0].plot([1,3,2])
axes[1].plot([8,2,5])
plt.subplots_adjust(wspace=0.6, hspace=0.6)

plt.show()ctrl + c
import matplotlib.pyplot as plt

loads Matplotlib module to use plotting capabilities

.subplots(

creates set of charts on a single chart area

.plot(

plot specified data

.subplots_adjust(

set subplot positioning params

wspace

horizontal subplots spacing

hspace

vertical subplots spacing

.show()

render chart in a separate window