I have a set of X,Y data points (about 10k) that are easy to plot as a scatter plot but that I would like to represent as a heatmap.
I looked through the examples in MatPlotLib and they all seem to already start with heatmap cell values to generate the image.
Is there a method that converts a bunch of x,y, all different, to a heatmap (where zones with higher frequency of x,y would be "warmer")?
Best Answer
If you don't want hexagons, you can use numpy's
histogram2d
function:This makes a 50x50 heatmap. If you want, say, 512x384, you can put
bins=(512, 384)
in the call tohistogram2d
.Example: