Reputation: 5915
I have a MATLAB pcolor
plot. Say something like this:
ixx = 1:10;
ixy = 2:2:25;
[x,y] = meshgrid(ixx, ixy);
pcolor(ixx, ixy, x+y)
When I use the data cursor, I don't get the value of the height of the cell, just the locations of the boundary of the cell:
Is there a way to force the cell value to appear in this plot? The associated cell should have value 23
, not z = 0
.
Note: In my real example, my axes are not uniform, so pcolor
is required here (as opposed to moving to imagesc
or similar, which does properly handle the data cursor).
Note: pcolor
"hides" the top row and right most column of data. [Not directly relevant to the question, but an important aspect of pcolor
]
Upvotes: 0
Views: 1440
Reputation: 19689
Use the handle of pcolor
to modify ZData
i.e.
ph = pcolor(ixx, ixy, x+y);
ph.ZData = ph.CData; % or set(ph, 'ZData', get(ph,'CData'));
Result:
Upvotes: 3