Data points' locations change when clicking into a scatter plot with the Data CUrsor
조회 수: 1 (최근 30일)
이전 댓글 표시
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);
hold on
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?
댓글 수: 0
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Scatter Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!