I have a 2D matrix I want to plot. The plotting itself works, but I need a colorbar with it. The figure only makes sense when the data is log-tranformed. And I want the colorbar show the original values. How do I do this?
A search provided A logarithmic colorbar in matplotlib scatter plot but I cannot make this work.
The code below gives an idea of what I attempt to do. Only the revevant lines are included (as far as I could see).
import matplotlib.pyplot as plt
from matplotlib import cm
import numpy as np
my_speed=np.ones(shape=(no,no))
fig=plt.figure(2)
ax=fig.add_subplot(1,1,1)
my_speed=np.log10(my_speed)
ax.imshow(my_speed, interpolation='bilinear', cmap=cm.jet)
plt.colorbar() #this does not work
plt.savefig('myspeedplot.png')
plt.close(2)
Thank you for any help