0

Here is the link to the Matlab function, I was wondering if anyone had come across something similar in python. I want to input X and Y arrays of the same length and generate what is essentially a heatmap. Where the frequency of times a coordinate falls in a bin dictates the color of said bin.

Any help is much appreciated or advice on how to do this in a different way!

Alex
  • 59
  • 3

1 Answers1

0

To put it simply...

If you can use numpy, there is a function for that - numpy.histogram2d ( http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.histogram2d.html ) to get data.

If you want to see the plot and you can use matplotlib, there is matplotlib.pyplot.hist2d (see example: http://matplotlib.org/examples/pylab_examples/hist2d_log_demo.html )

And (disclaimer: I wrote it and want to get some publicity for it ;-)) you can use the physt library. See the examples of 2D histograms here: http://nbviewer.jupyter.org/github/janpipek/physt/blob/master/doc/2D%20Histograms.ipynb

honza_p
  • 2,073
  • 1
  • 23
  • 37