I have a matrix plot produced by the matplotlib library. The size of my matrix is 256x256, and I already have a legend and a colorbar with proper ticks. I cannot attach any image due to my being new to stackoverflow. Anyhow, I use this code to generate the plot:
# Plotting - Showing interpolation of randomization
plt.imshow(M[-257:,-257:].T, origin='lower',interpolation='nearest',cmap='Blues', norm=mc.Normalize(vmin=0,vmax=M.max()))
title_string=('fBm: Inverse FFT on Spectral Synthesis')
subtitle_string=('Lattice size: 256x256 | H=0.8 | dim(f)=1.2 | Ref: Saupe, 1988 | Event: 50 mm/h, 15 min')
plt.suptitle(title_string, y=0.99, fontsize=17)
plt.title(subtitle_string, fontsize=9)
plt.show()
# Makes a custom list of tick mark intervals for color bar (assumes minimum is always zero)
numberOfTicks = 5
ticksListIncrement = M.max()/(numberOfTicks)
ticksList = []
for i in range((numberOfTicks+1)):
ticksList.append(ticksListIncrement * i)
cb=plt.colorbar(orientation='horizontal', format='%0.2f', ticks=ticksList)
cb.set_label('Water depth [m]')
plt.show()
plt.xlim(0, 255)
plt.xlabel('Easting (Cells)')
plt.ylim(255, 0)
plt.ylabel('Northing (Cells)')
Now, being my subtitle too long (3rd line of code in the excerpt reported here), it interferes with the Y axis ticks, and I don't want this. Instead, some of the information reported in the subtitle I would like to be re-routed to a line of text to be placed at the bottom center of the image, under the colorbar label. How can this be done with matplotlib?