I want to plot images (in the 1st row) along with some diagrams (the 2nd and 3rd rows) using subplots
from matplotlib.pyplot
. However, imshow
fucntion adds some additional white space around images I can't get rid of. Here is my code and the plot I'm getting:
rcParams['figure.figsize'] = (16, 14)
_, axes = plt.subplots(3, 3)
axes[0][0].imshow(image)
axes[0][0].set_title('title')
axes[0][0].set_xticklabels(list())
axes[0][0].set_yticklabels(list())
axes[0][0].grid(False)
axes[0][1].imshow(image)
axes[0][1].set_title('title')
axes[0][1].set_xticklabels(list())
axes[0][1].set_yticklabels(list())
axes[0][1].grid(False)
axes[0][2].imshow(image)
axes[0][2].set_title('title')
axes[0][2].set_xticklabels(list())
axes[0][2].set_yticklabels(list())
axes[0][2].grid(False)
plt.savefig(file_name, bbox_inches='tight')
in the plot below you can clearly see that there is significantly more space between the 1st and 2nd rows:
I would like to have an equal space between all subplots. What would be the easiest way to do this?
Thanks in advance for any advice!
Best, Alexey