# Matlab scatter hotmap [closed]

I have two columns of data, x(angle) and y(distance), they are my experiment results(figure 1). How can I use these results to make a ‘hotmap diagram’ by matlab? The z axis is the density value of xy dots in the 2D coordinate department, like below figure2. Thank you!

## closed as off-topic by Nathan Reed, Christian Rau, trichoplax♦Nov 16 '17 at 21:50

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "Questions about creating artwork or using graphics software as an end-user are off-topic for this site. Consider if your question might be re-written to fit on Graphic Design. If your question is about Blender, it might fit on Blender." – Nathan Reed, Christian Rau, trichoplax
If this question can be reworded to fit the rules in the help center, please edit the question.

You basically need to plot the scatter map with varying colors for each point

scatter(x, y, [], c);


The main difficulty is to calculatec so that it’s proportional to the density.

To do so you can divide the map into a grid of a certain resolution, say [res_x, res_y]. Then count for each grid cell how many points are there. This count is an approximation of the density at that grid cell. Finally you can assign to all points within this grid cell the c value equal this count.

Probably you also need to normalize c to [0, 1]

• Thank you for your help, I can understand your answer, but I don’t know which function should I choice to calculate the density? – user239932 Nov 15 '17 at 4:17
• That's already in the answer: use the count. – Pikalek Nov 16 '17 at 14:31