[Chicago] binned scatterplot

Ken Schutte kenschutte at gmail.com
Wed Dec 18 20:15:53 CET 2013


Have you found the 'hist2d' function?

http://matplotlib.org/api/pyplot_api.html?highlight=hist2d#matplotlib.pyplot.hist2d
example,
http://matplotlib.org/examples/pylab_examples/hist2d_log_demo.html

That should do the binning for you.  It returns the counts matrix and x and
y edges (that define the bins) so you can do custom coloring (as opposed to
the default which just colors according to counts in each bin).

Ken






On Wed, Dec 18, 2013 at 12:05 PM, Oren Livne <livne at uchicago.edu> wrote:

> Dear All,
>
> I have two matching arrays, x and y. I'd like to create a histogram of y
> vs. x. Instead of individual scatter points, I'd like to bin them into
> (x,y) combinations that form a 2-D array of cells, count the number of
> points within each cell, color the cell according to its distance from the
> diagonal (y=x), and have its intensity be proportional to the number of
> points in the cell. Is there a clean way of doing this with matplotlib?
>
> Thanks,
> Oren
> _______________________________________________
> Chicago mailing list
> Chicago at python.org
> https://mail.python.org/mailman/listinfo/chicago
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/chicago/attachments/20131218/678ff651/attachment.html>


More information about the Chicago mailing list