Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: davide lasagna <lasagnadavide@gm...>  20090720 14:05:17

Hello everybody, this is my first post in this list. I'm plotting a spectrogram with Pxx, freqs, bins, im = specgram(y, nfft=256, f_sampling=12000) and i want to add a colorbar with colorbar() The problem is that the color scale seems to be wrong with respect to the data in Pxx, i.e. Pxx is of the order of 1e2 while in the colorbar i have tick values spanning from 20 to 180. What is the problem?? Thanks in advance! Davide 
From: davide lasagna <lasagnadavide@gm...>  20090720 14:05:17

Hello everybody, this is my first post in this list. I'm plotting a spectrogram with Pxx, freqs, bins, im = specgram(y, nfft=256, f_sampling=12000) and i want to add a colorbar with colorbar() The problem is that the color scale seems to be wrong with respect to the data in Pxx, i.e. Pxx is of the order of 1e2 while in the colorbar i have tick values spanning from 20 to 180. What is the problem?? Thanks in advance! Davide 
From: Eric Firing <efiring@ha...>  20090721 19:12:24

davide lasagna wrote: > Hello everybody, > this is my first post in this list. > > I'm plotting a spectrogram with > > Pxx, freqs, bins, im = specgram(y, nfft=256, f_sampling=12000) > > and i want to add a colorbar with > > colorbar() > > > The problem is that the color scale seems to be wrong with respect to > the data in Pxx, i.e. Pxx is of the order of 1e2 while in the colorbar > i have tick values spanning from 20 to 180. What is the problem?? specgram and psd plot power in decibels: 10*log10(Pxx). Because they involve heavy computation and applicationspecific choices, like the decibel scale, they really should not be axes methods. You can make a function plot the spectrogram however you like by looking at the source code in the Axes.specgram method (the pyplot specgram function is just a thin wrapper for this method), which is using mlab.specgram to do the calculation and is then just scaling and plotting. Eric > > Thanks in advance! > > > Davide > > >  > Enter the BlackBerry Developer Challenge > This is your chance to win up to $100,000 in prizes! For a limited time, > vendors submitting new applications to BlackBerry App World(TM) will have > the opportunity to enter the BlackBerry Developer Challenge. See full prize > details at: http://p.sf.net/sfu/Challenge > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers 
From: davide lasagna <lasagnadavide@gm...>  20090722 07:06:44

Thanks Eric for pointing out this. However i've found that psd and specgram plot 10*log10*(Pxx/max(Pxx)), so i'll have a range from 0 db down. Anyway, what do you mean by "should not be axes method"? Do you mean using the array output of specgram and psd and plotting that result by myself? Cheers Davide On Tue, 20090721 at 09:12 1000, Eric Firing wrote: > davide lasagna wrote: > > Hello everybody, > > this is my first post in this list. > > > > I'm plotting a spectrogram with > > > > Pxx, freqs, bins, im = specgram(y, nfft=256, f_sampling=12000) > > > > and i want to add a colorbar with > > > > colorbar() > > > > > > The problem is that the color scale seems to be wrong with respect to > > the data in Pxx, i.e. Pxx is of the order of 1e2 while in the colorbar > > i have tick values spanning from 20 to 180. What is the problem?? > > specgram and psd plot power in decibels: 10*log10(Pxx). > > Because they involve heavy computation and applicationspecific choices, > like the decibel scale, they really should not be axes methods. > > You can make a function plot the spectrogram however you like by looking > at the source code in the Axes.specgram method (the pyplot specgram > function is just a thin wrapper for this method), which is using > mlab.specgram to do the calculation and is then just scaling and plotting. > > Eric > > > > > > Thanks in advance! > > > > > > Davide > > > > > >  > > Enter the BlackBerry Developer Challenge > > This is your chance to win up to $100,000 in prizes! For a limited time, > > vendors submitting new applications to BlackBerry App World(TM) will have > > the opportunity to enter the BlackBerry Developer Challenge. See full prize > > details at: http://p.sf.net/sfu/Challenge > > _______________________________________________ > > Matplotlibusers mailing list > > Matplotlibusers@... > > https://lists.sourceforge.net/lists/listinfo/matplotlibusers > 
From: Eric Firing <efiring@ha...>  20090722 08:36:59

davide lasagna wrote: > Thanks Eric for pointing out this. However i've found that psd and > specgram plot 10*log10*(Pxx/max(Pxx)), so i'll have a range from 0 db > down. Aha, I wasn't looking closely enough! > Anyway, what do you mean by "should not be axes method"? That was a side remark about what the Axes class should do or not do. I would prefer that it stick to plotting. For example, at present it does not have a method for empirical orthogonal functions, or for waveletsand that's good, it shouldn't. Numerical code (usually in numpy or scipy) should do the calculations, and then the result should be plotted using Axes methods or pyplot functions for line plotting, contouring, making images, etc. So getting back to the specgram, I would prefer that it be given as an examplea script combining the calculation with the plottingrather than having calculation and plotting done in an Axes method. > Do you mean using the array output of specgram and psd and plotting that > result by myself? The calculations are being done by functions in the matplotlib.mlab module, so yes, I suggest using those functions directly (not the pyplot functions that wrap the Axes methods that call the mlab functions and then plot the result) and then doing your own scaling and plotting. The Axes specgram method might guide you in the latter (giving an example of how to use imshow, for example), but if you write your own function you can make it do exactly what you want instead of accepting the scaling choice imposed by the Axes method. Eric > > Cheers > > Davide > On Tue, 20090721 at 09:12 1000, Eric Firing wrote: >> davide lasagna wrote: >>> Hello everybody, >>> this is my first post in this list. >>> >>> I'm plotting a spectrogram with >>> >>> Pxx, freqs, bins, im = specgram(y, nfft=256, f_sampling=12000) >>> >>> and i want to add a colorbar with >>> >>> colorbar() >>> >>> >>> The problem is that the color scale seems to be wrong with respect to >>> the data in Pxx, i.e. Pxx is of the order of 1e2 while in the colorbar >>> i have tick values spanning from 20 to 180. What is the problem?? >> specgram and psd plot power in decibels: 10*log10(Pxx). >> >> Because they involve heavy computation and applicationspecific choices, >> like the decibel scale, they really should not be axes methods. >> >> You can make a function plot the spectrogram however you like by looking >> at the source code in the Axes.specgram method (the pyplot specgram >> function is just a thin wrapper for this method), which is using >> mlab.specgram to do the calculation and is then just scaling and plotting. >> >> Eric >> >> >>> Thanks in advance! >>> >>> >>> Davide >>> >>> >>>  >>> Enter the BlackBerry Developer Challenge >>> This is your chance to win up to $100,000 in prizes! For a limited time, >>> vendors submitting new applications to BlackBerry App World(TM) will have >>> the opportunity to enter the BlackBerry Developer Challenge. See full prize >>> details at: http://p.sf.net/sfu/Challenge >>> _______________________________________________ >>> Matplotlibusers mailing list >>> Matplotlibusers@... >>> https://lists.sourceforge.net/lists/listinfo/matplotlibusers > > >  > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers 
Sign up for the SourceForge newsletter:
No, thanks