[SciPy-Dev] 2D histogram: request for plotting variable bin size
Sat Feb 2 13:59:03 CST 2013
So I registered an account, but I have to request write permission by
email to email@example.com first.
So could somebody give me write permission to the page
and maybe also to http://www.scipy.org/Cookbook/Matplotlib ?
Or otherwise could somebody add the example below for me?
import numpy as np, matplotlib.pyplot as plt
x = np.random.normal(3, 2, 1000)
y = np.random.normal(3, 1, 1000)
H, yedges, xedges = np.histogram2d(y,x, bins=(yedges,xedges))
extent = [xedges, xedges[-1], yedges[-1], yedges]
#If bin size is equal imshow can be used. It is fast and provides
#plt.imshow(H, extent=extent, interpolation='None',
#To display variable bin size pcolar can be used
X,Y = np.meshgrid(xedges, yedges)
#If interpolation is needed in addition matplotlib provides the
On 2013-02-02 16:44, Sturla Molden wrote:
> On 02.02.2013 10:53, Frank Breitling wrote:
>> From the matplotlib developers it was pointed out, that there is a
>> NonUniformImage which might be suite for representing interpolated
>> variable bin size 2D histograms
>> There even exists an example
>> but it is very isolated and therefore not well known.
>> It would be very useful to explain its usage or at least link to it in
>> the histogram2d example at
>> In addition a pcolor example (attached below) shouldn't be missing. Even
>> though it is slow and can't do interpolation, it can at least do a
>> correct representation for academic purposes.
>> Can anybody do that or would you like me to do that myself?
> Since it is at the top of your head, why don't you do it?
> But it might be better for the SciPy Cookbook's matplotlib section
> than the NumPy docs. I'm not sure if they want matplotlib examples in
> the NumPy documentation (ask on the NumPy list before you waste your
> time on it).
> SciPy-Dev mailing list
More information about the SciPy-Dev