Hay muchas preguntas sobre matplotlib COLORBAR desbordamiento de pila, pero no puedo dar sentido a ellos con el fin de resolver mi problema.cómo agregar Matplotlib de Colorbar garrapatas
¿Cómo se configuran los yticklabels en la barra de colores?
Aquí es un código de ejemplo:
from pylab import *
from matplotlib.colors import LogNorm
import matplotlib.pyplot as plt
f = np.arange(0,101) # frequency
t = np.arange(11,245) # time
z = 20*np.sin(f**0.56)+22 # function
z = np.reshape(z,(1,max(f.shape))) # reshape the function
Z = z*np.ones((max(t.shape),1)) # make the single vector to a mxn matrix
T, F = meshgrid(f,t)
fig = plt.figure()
ax = fig.add_subplot(111)
plt.pcolor(F,T,Z, norm=LogNorm(vmin=z.min(),vmax=z.max()))
plt.xlim((t.min(),t.max()))
mn=int(np.floor(Z.min())) # colorbar min value
mx=int(np.ceil(Z.max())) # colorbar max value
md=(mx-mn)/2 # colorbar midpoint value
cbar=plt.colorbar() # the mystery step ???????????
cbar.set_yticklabels([mn,md,mx]) # add the labels
plt.show()
Estoy usando eclipse con pydev y algunas veces solo pego el código en la línea de comando de python. No estoy exactamente seguro de lo que sugiere, pero lo investigaré porque me parece útil. – sequoia
gracias, un buen consejo para ver qué métodos están disponibles en el futuro. – sequoia