Benoit,

Is there any particular reason why you can't do a log10() of the data that
is being pcolor()'d and then label the colorbar as having units of dB?  That
would seem to be the most straight-forward approach to me.

Ben Root


2010/6/24 Benoit Donnet <benoit.don...@uclouvain.be>

> 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
>
>
>
>
> ---
> Dr. Benoit Donnet
> Université catholique de Louvain (UCL)
> Ecole Polytechnique de Louvain (EPL) - Département d'Ingénierie
> Informatique (INGI)
> Place Sainte Barbe, 2
> B-1348 Louvain-la-Neuve
> Phone: +32 10 47 87 18
> Fax: +32 10 45 03 45
>
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit.  See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to