The scatter
function has two undocumented properties 'jitter'
and 'jitterAmount'
that allow to jitter the data on the x-axis only. This dates back to Matlab 7.1 (2005), and possibly earlier.
To enable this feature set the 'jitter'
property to 'on'
and set the 'jitterAmount'
property to the desired absolute value (the default is 0.2
).
This is very useful when we want to visualize overlapping data, for example:
scatter(ones(1,10), ones(1,10), 'jitter', 'on', 'jitterAmount', 0.5);
Read more on Undocumented Matlab