MATLAB: How to convert Matlab scatterplot axis to display pixels

axisaxis conversionaxis unitsscatterplot

I am drawing a circle via scatterplot and it plots it in the form of arbitrary units. I want those units to be in pixels so I can run some further algos on them. Imdistline doesn't do much as it only displays the distance in terms of the arbitrary units.

Best Answer

Set the XLim and YLim properties of your axes to match the 'Position' property of your axes (doing the obvious maths to go from the start, size represented by position to the start, end needed by xlim and ylim), either relative to the figure (i.e. taken directly from 'Position' with the origin the same) or relative to the axes start (i.e. origin at 0 and x and y lim just set to the size of the axes).
Then draw your circle and it will be in pixel space.