SourceForge logo
SourceForge logo
Menu

matplotlib-users

From: marcog <ma...@ga...> - 2009年04月29日 14:59:14
Hi
I have a set of 2 dimensional data that I would like to form a histogram of.
Each data point is defined by an x and y variable. So essentially what I
would like to obtain is a "row" of histograms as produced by the plot.hist
function, stacking them next to one another in a single 3D plot. For
example, something like [1], but I don't need it to be interpolated.
[1] http://www.mathworks.com/matlabcentral/fx_files/14205/1/hist.jpg
Thanks!
Marco
-- 
View this message in context: http://www.nabble.com/Histogram-of-2D-Data-tp23296104p23296104.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: John H. <jd...@gm...> - 2009年04月29日 15:29:23
On Wed, Apr 29, 2009 at 9:59 AM, marcog <ma...@ga...> wrote:
>
> Hi
>
> I have a set of 2 dimensional data that I would like to form a histogram
> of.
> Each data point is defined by an x and y variable. So essentially what I
> would like to obtain is a "row" of histograms as produced by the plot.hist
> function, stacking them next to one another in a single 3D plot. For
> example, something like [1], but I don't need it to be interpolated.
>
> [1] http://www.mathworks.com/matlabcentral/fx_files/14205/1/hist.jpg
hexbin may be what you are looking for, which does a 2D colormapped
histogram, with an optional reduce function so you can specify the intensity
function over the bins
http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.hexbin
 http://matplotlib.sourceforge.net/examples/pylab_examples/hexbin_demo.html
http://matplotlib.sourceforge.net/examples/pylab_examples/hexbin_demo2.html
JDH
From: Marco G. <ma...@ga...> - 2009年04月30日 09:57:13
Thanks, this works well. My current result can be seen at [1]. The x
data is real numbers, while the y data is integers; so I set the
number of y-bins to the range of the y data.
What I'd like to do now is scale the plot such that for every y value
the sum of the intensities are equal. Let count[j] be the number of
data points having y value equal to j, and let product be the product
of all non-zero count[j]. One possible solution would be to put in
each data point (product / count[j]) times, but since product is far
too large this won't work (even the lcm is too huge). Is there a
better solution to do this using matplotlib?
[1] http://people.cs.uct.ac.za/~mgallott/resources/plot.png
Thanks
Marco
On Wed, Apr 29, 2009 at 5:29 PM, John Hunter <jd...@gm...> wrote:
>
>
> On Wed, Apr 29, 2009 at 9:59 AM, marcog <ma...@ga...> wrote:
>>
>> Hi
>>
>> I have a set of 2 dimensional data that I would like to form a histogram
>> of.
>> Each data point is defined by an x and y variable. So essentially what I
>> would like to obtain is a "row" of histograms as produced by the plot.hist
>> function, stacking them next to one another in a single 3D plot. For
>> example, something like [1], but I don't need it to be interpolated.
>>
>> [1] http://www.mathworks.com/matlabcentral/fx_files/14205/1/hist.jpg
>
>
> hexbin may be what you are looking for, which does a 2D colormapped
> histogram, with an optional reduce function so you can specify the intensity
> function over the bins
>
>
> http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.hexbin
>  http://matplotlib.sourceforge.net/examples/pylab_examples/hexbin_demo.html
>
> http://matplotlib.sourceforge.net/examples/pylab_examples/hexbin_demo2.html
>
> JDH
>
-- 
Marco Gallotta
MSc Student | SACO Scientific Committee | ACM ICPC Coach
Department of Computer Science, University of Cape Town
people.cs.uct.ac.za/~mgallott | marco-za.blogspot.com
marco AT gallotta DOT co DOT za | 073 170 4444 | 021 552 2731
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /