I have a matrix with 3 columns. The first two columns are coordinates and the third is weight or intensity.
newmat = [ 27.37 -45.69 14.47
27.37 -45.68 18.58
27.37 -45.67 29.05
27.37 -45.66 51.7
... ... ... ]
I have already created a scatter plot:
However, I'd like to have something like a density plot (as the second plot here). I have tried to use hist3
function as in here, but I didn't figure out how to take into account the third column - weight.
You could create a matrix from the data in
newmat
(using the functionssortrows
,unique
, andaccumarray
) and plot it as an image:Here's some sample data similar to your format:
And here's the plot the above code produces from that data: