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 |