My goal is to plot three Graphs as subplots and use just one colorbar for the three of them, I have tryed that by making a figure with 4 subplots like shown in the following Code:
fig=plt.figure()
ax1=plt.subplot(1,3,1)
im=ax1.contourf( MC, 50,vmax=Max_abs,vmin=Min_abs)
x0,x1 = ax1.get_xlim()
y0,y1 = ax1.get_ylim()
ax1.set_aspect((x1-x0)/(y1-y0))
ax2=plt.subplot(1,3,2,aspect=1)
im2=ax2.contourf( averagedM, 50,vmax=Max_abs,vmin=Min_abs)
ax3=plt.subplot(1,3,3,aspect=1)
im3=ax3.contourf( residualM, 50,vmax=Max_abs,vmin=Min_abs)
#cax = divider.append_axes("right", size="5%", pad=0.05)
im4 = plt.colorbar(im3, ax=[ax1, ax2, ax3])
#cb.ax.set_visible(True)
plt.show()
The Matrices M1, M2 and M3 are previously computed in the Code, but I guess for my Problem that is not very important. The Problem is that the colorbar doesnt fit the size of the rest of the plots, there are some similar Questions already asked About this Topic but None of them were useful to my Code, so I would like to know how to adjust the colorbar in this specific case.