any way of having something like pcolorfast results with log scale ?

Hello,

I made a crude sonogram https://gist.github.com/2983547 with the note
names instead of the frequency. But, It really angers me not to be
able to have a log scale for the frequency.

Does any well known workaround exists?
Is there an easy way to grosso modo do :
x = time, y = frequency, z=amplitude of spectre with something like a
specter of one croche at time = t according to the bpm and make an y
scale logarithmic, then project the amplitude (z) with a colormap on
x,y plane according to the amplitude, and and have 3D representation?

Basically, I guess it boils down to know if combining those 2 is
possible : http://matplotlib.sourceforge.net/examples/mplot3d/contourf3d_demo2.html
+ log scale for y. I guess I could improve the result by using
logscale on Z and colormap
(http://stackoverflow.com/questions/5748076/python-matplotlib-contour-plot-logarithmic-color-scale)

Since it is only for fun, and I don't want to invest myself too much
my question is really did I missed something while googling for an
easy solution and if so, what are the good keywords?

Cheers

···

--
Julien

Julien,

I am not entirely sure if I understood your question right, but I think I can answer part of it. With respect to using a log scale for 3d axes, it should work, but unfortunately, I have never been able to get it to work properly. It is an outstanding bug for mplot3d. The “work-around” is to do the log transformation yourself for the input x/y/z data.

However, there is no reason why you can’t use a LogNorm for your colormap. Just so you understand, color scales in matplotlib are done in two parts. We have the “Norm” objects which takes data and produce values between 0 and 1 (and handles bad, over, and under values accordingly). And we have “colormap” objects that take values from 0 to 1 and produce an RGB(A) array. By default, most functions in matplotlib will use the min/max of the input data to automatically create a linear Norm object, and will use the “prism” colormap. However, you can create a LogNorm object and pass it in as the ‘norm’ kwarg in most plotting functions.

I hope this helps!
Ben Root

···

On Mon, Jun 25, 2012 at 10:03 AM, julien tayon <julien@…4072…> wrote:

Hello,

I made a crude sonogram https://gist.github.com/2983547 with the note

names instead of the frequency. But, It really angers me not to be

able to have a log scale for the frequency.

Does any well known workaround exists?

Is there an easy way to grosso modo do :

x = time, y = frequency, z=amplitude of spectre with something like a

specter of one croche at time = t according to the bpm and make an y

scale logarithmic, then project the amplitude (z) with a colormap on

x,y plane according to the amplitude, and and have 3D representation?

Basically, I guess it boils down to know if combining those 2 is

possible : http://matplotlib.sourceforge.net/examples/mplot3d/contourf3d_demo2.html

  • log scale for y. I guess I could improve the result by using

logscale on Z and colormap

(http://stackoverflow.com/questions/5748076/python-matplotlib-contour-plot-logarithmic-color-scale)

Since it is only for fun, and I don’t want to invest myself too much

my question is really did I missed something while googling for an

easy solution and if so, what are the good keywords?

Cheers

Julien