[SciPy-Dev] 2D histogram: request for plotting variable bin size

Sturla Molden sturla@molden...
Thu Jan 31 09:56:22 CST 2013

On 31.01.2013 16:32, Frank Breitling wrote:

> My experience with pcolor was that is was very slow.

imshow is fast because it basically just bitblit the image. You can 
always use Python (or Cython, Fortran or C) to prepare an image from 
your 2D data and pass that to imshow.

I showed you can example where I used contourf. I kind of show too, but 
I often just let the computer run for a while and prepare a bunch of PDF 
files with the spectrums. Then I can take those into e.g. Adobe 
Illustrator later on, and I will also store the wavelet data in PyTables 
(HDF5) files.

If I needed to render a spectrum in "real-time", I would use imshow or 
OpenGL, and e.g. have my own Fortran 90 code prepare the displayed 
image. I might even consider to use PyOpenGL to write vertex shaders and 
have the graphics hardware do all the rendering.

So it really depends on how fast you need it to be. Python code can draw 
your data with OpenGL at the full speed that your graphics hardware 
allows. Or you can settle for slower but more convenient data 
visualization methods like pcolor and contourf. Or you can do something 
in between.

But as for the question you asked (how to draw a 2D historgram), pcolor 
does exactly that. I did not say it will be fast for huge data sets. I 
thought you were used to e.g. Matlab and wanted something like image or 
imagesc, and then found imshow but overlooked pcolor.



More information about the SciPy-Dev mailing list