This is my data matrix in MATLAB:
a = [43.676289 -79.477386 1
43.676370 -79.477107 5
43.676517 -79.477375 20
43.676417 -79.477509 8
43.676129 -79.477278 15];
The first column is Y
axis, the second column is X
axis and the third column is my data. How can I draw a bar graph, and adjust the color of the bars according to the value of data (like colorbar
in a surface plot) for each data point in MATLAB?
I added an example graph which I drew for another data matrix. In this example X, Y, and Z were linear and I could draw this graph using 'surf' command with no problem. I need to draw the same graph for mentioned data, but the unit of the XY
axis is not compatible with Z
, and this confused me.
Just as an additional comment, if we plot only the XY plane, the result looks like the next picture:
scatter(a(:,2),a(:,1),'*')
Moreover, this is a simple example that might be useful to expand it:
z = [5 0 2 0
0 0 0 0
0 0 0 0
0 0 0 0];
[X,Y] = meshgrid(0:1:3);
surf(X,Y,Z)
Thanks