Hist3 error when displayed

1 view (last 30 days)
Bran
Bran on 18 Jul 2016
I am turning a scatter plot into a matrix where the number in each 'pixel' is the number of scatter points in that bin
I have been using hist3() to help me do this. If for example I have values ranging from -0.4 to 0.4 in the x axis and 0 to 10 in the y axis on the scatter plot. I have been calling up the Data = [ xvalues, yvalues]
I have been using [num,bincenters] = hist3(Data,{-0.45:0.02:0.45 -0.5:0.02:10.5})
xcenters = bincenters{1} ycenters = bincenters{2}
then imagesc(xcenters,ycenters,num)
The shape seems correct, however, the graph seems to be shifted and so not sitting in quite the correct place in terms of the x and y axis. What am I doing wrong?

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!