I'm trying to set the size of markers in my scatter plot to the size of a pixel in my plot. At the moment, I'm calculating the marker size using the following code:
% Setting the size of square markers to 1px^2
s=1.0; currentunits = get(gca,'Units'); set(gca, 'Units', 'Points'); axpos = get(gca,'Position'); set(gca, 'Units', currentunits); markerWidth = s/diff(xlim)*axpos(3); % Calculate Marker width in points
s = markerWidth^2;
So, I'm adjusting the value of s from 1 px to its size in points^2, which is how the marker size is defined. But the output is not quite giving me what I want:
What's going on here? Why are the marker sizes still smaller than the image sizes?
Best Answer