I have two scatter plots on the same graph (same x, but different y values for the two series). Many data points within each series have the same x value, and so I used the jitter option of the scatter function. The code below is a simplified version of the actual code, to help with debugging:
x = 1:10;
y1 = [12 65 34 87 99 35 67 54 21 85];
plot1 = scatter(x, y1, 90, 'MarkerFaceColor',[0.5 0.5 0.5], 'MarkerEdgeColor', [0 0 0], 'jitter', 'on', 'jitterAmount', 2);
y2 = 1+1.1*y1;
plot2 = scatter(x, y2, 90, 's', 'MarkerFaceColor',[0.8 0.8 0.8], 'MarkerEdgeColor', [0 0 0], 'jitter', 'on', 'jitterAmount', 2);
In the resulting plot, when I choose the Data Cursor and click on any data point, the position of the data points changes (by quite a lot!). In the process of simplifying my code to the above minimal working example, I discovered that this is due to the jitter options; if these are removed, the problem disappears.
I actually do need to use some jitter for this plot, given the otherwise overlapping data points. But even without using the Data Cursor, it seems that the data points are plotted in incorrect locations, thus I suspect this is simply a bug with scatter's jitter options, which would make some sense given they are actually undocumented (at least in my version 2016a - see here). Can this somehow be worked around?