Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
568 views
in Technique[技术] by (71.8m points)

python - How to get colorbar of cmp to logarithmic scale

I have been trying to create a colormap that looks something like this:

enter image description here

I have been using this code:

 import numpy as np
 import matplotlib.pyplot as plt
    

y= np.log10(split1)#np.linspace(np.log10(min(dok2)),np.log10(max(dok2[dok2<1e8])),bins1)
x= ind_pvi#np.linspace(np.log10(min(dok)),np.log10(max(dok)),steps)

xx, yy = np.meshgrid(x, y)

z = relative1

plt.imshow(z, interpolation='nearest',cmap=plt.cm.jet, extent=[np.log10(min(ind_pvi)),np.log10(max(ind_pvi)),np.log10(min(split1)),np.log10(max(split1))])
plt.colorbar()
plt.show()

from mpl_toolkits.mplot3d import Axes3D
ax = Axes3D(plt.figure())

ax.plot_surface(xx,yy, z, cmap=plt.cm.jet, cstride=1, rstride=1)
plt.show()

Up until now, I managed to do this:

enter image description here

So I would like to renormalize the color bar to look something like the first figure.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...