| Graphics | ![]() |
XData and YData
The XData and YData properties control the coordinate system of the image. For an m-by-n image, the default XData is [1 n] and the default YData is [1 m]. These settings imply the following:
X = [1 2 3 4; 5 6 7 8; 9 10 11 12]; h = image(X); colormap(colorcube(12)) xlabel x; ylabel y
The XData and YData properties of the resulting image object have the default values shown below.
get(h,'XData')
ans =
1 4
get(h,'YData')
ans =
1 3
However, you can override the default settings to specify your own coordinate system. For example, the statements,
X = [1 2 3 4; 5 6 7 8; 9 10 11 12]; image(X,'XData',[-1 2],'YData',[2 4]); colormap(colorcube(12)) xlabel x; ylabel y
| CDataMapping | EraseMode | ![]() |