| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Image Processing Toolbox |
| Contents | Index |
| Learn more about Image Processing Toolbox |
pixelx = axes2pix(dim, XDATA, AXESX)
pixelx = axes2pix(dim, XDATA, AXESX) converts an axes coordinate into a pixel coordinate. For example, if pt = get(gca,'CurrentPoint') then AXESX could be pt(1,1) or pt(1,2). AXESX must be in pixel coordinates. XDATA is a two-element vector returned by get(image_handle, 'XData') or get(image_handle,'YData'). dim is the number of image columns for the x coordinate, or the number of image rows for the y coordinate.
dim, XDATA, and AXESX can be double. The output is double.
axes2pix performs minimal checking on the validity of AXESX, DIM, or XDATA. For example, axes2pix returns a negative coordinate if AXESX is less than XDATA(1). The function calling axes2pix bears responsibility for error checking.
Example with default XData and YData.
h = imshow('pout.tif');
[nrows,ncols] = size(get(h,'CData'));
xdata = get(h,'XData')
ydata = get(h,'YData')
px = axes2pix(ncols,xdata,30)
py = axes2pix(nrows,ydata,30)Example with non-default XData and YData.
xdata = [10 100] ydata = [20 90] px = axes2pix(ncols,xdata,30) py = axes2pix(nrows,ydata,30)
impixelinfo, bwselect, imfill, impixel, improfile, roipoly
![]() | applylut | bestblk | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |