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

Frank Breitling fbreitling@aip...
Fri Feb 1 04:36:24 CST 2013

Hi Strula,

Thank you very much for your answer and examples. What I understand form 
them is that there is currently no simple and fast method for plotting 
2D histograms with variable bin width.

Therefore I would like to come back to my initial feature request for 
imshow. It seems to me that with an implementation of a variable bin 
width all other solutions would collapse into a one-liner providing even 
best performance. From a technical perspective I understand that the 
philosophy behind imshow is to keep it simple to maintain its high 
speed. On the other hand a smart implementation of a variable bin width 
should at most result in a small penalty at the start of the execution.

Therefore I would like to confirm my feature request to imshow.
However, since this is a matplotlib issue (as you pointed out before), I 
should probably file it at their trackers.

Thanks again for your replies


On 31.01.2013 16:56, Sturla Molden wrote:
> 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.
> :-)
> Sturla
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev

More information about the SciPy-Dev mailing list