Hi guys,

I'm struggling with colorbar since this morning. I'd like the colorbar being logscale

I'm experimenting some strange behavior with the colorbar as some 'labels' appear several times. For instance, 10^0 appears three times, 10^1 appears also three times, and so on. I believe the exponent is the digit of the float, while I'd like to see the exponent (of the scientific notation)

I attach a png of the plot

Here is my code:

k,m,fp = np.loadtxt(file, unpack=True)

ki = linspace(k.min(), k.max(), 37)

mi = linspace(m.min(), m.max(), 37)

Z = griddata(k, m, fp, ki, mi)

Z.shape

K, M = meshgrid(ki, mi)

pcolor(K, M, log10(Z))#, cmap=cm.gray)

cbar = colorbar(format=FormatStrFormatter('$10^{%d}$'))

semilogy()

axis([1,20,10000,500000], font2)

xlabel(r'\textrm{\# hash functions ($k$)}', font)

ylabel(r'\textrm{vector size ($m$)}', font)

cbar.ax.set_ylabel(r'$f_p$', font)

I obviously suspect my code is flawed somewhere but I can't figure out where. i have tested several format for the colorbar, like LogFormatterMathText, but it does not solve my problem.

I would appreciate any kind of help. Thanks in advance

Keep on Rockin'

Benoit