[Numpy-discussion] Problems understanding histogram2d

eat e.antero.tammi@gmail....
Fri Jul 20 17:58:23 CDT 2012


Hi,

On Fri, Jul 20, 2012 at 6:42 PM, yogesh karpate <yogeshkarpate@gmail.com>wrote:

> I think since its a joint histogram, you need to have equal no. of data
> points and bins
> in both x and y.

Makes sense that number of elements of data points (x, y) is equal. Perhaps
the documentation like
http://docs.scipy.org/doc/numpy-1.6.0/reference/generated/numpy.histogram2d.html
could
make this aspect more clearer.

Especially confused is the requirement that *x* : array_like, shape(N,) and
*y* : array_like, shape(M,), may indicate that N!= M could be a feasible
case. A slightly better way would just state that x and y must be
one dimensional and they must be equal length.


My 2 cents,
-eat

>
>
> On Fri, Jul 20, 2012 at 5:11 PM, Andreas Hilboll <lists@hilboll.de> wrote:
>
>> Hi,
>>
>> I have a problem using histogram2d:
>>
>>    from numpy import linspace, histogram2d
>>    bins_x = linspace(-180., 180., 360)
>>    bins_y = linspace(-90., 90., 180)
>>    data_x = linspace(-179.96875, 179.96875, 5760)
>>    data_y = linspace(-89.96875, 89.96875, 2880)
>>    histogram2d(data_x, data_y, (bins_x, bins_y))
>>
>>    AttributeError: The dimension of bins must be equal to the dimension of
>> the sample x.
>>
>> I would expect histogram2d to return a 2d array of shape (360,180), which
>> is full of 256s. What am I missing here?
>>
>> Cheers,
>> Andreas.
>>
>> _______________________________________________
>> NumPy-Discussion mailing list
>> NumPy-Discussion@scipy.org
>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>
>
>
>
> --
>     Regards
> Yogesh Karpate
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20120721/f68bdf90/attachment.html 


More information about the NumPy-Discussion mailing list