Data points' locations change when clicking into a scatter plot with the Data CUrsor

2 ビュー (過去 30 日間)
z8080
z8080 2020 年 1 月 24 日
回答済み: z8080 2020 年 2 月 4 日
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?

採用された回答

z8080
z8080 2020 年 2 月 4 日
In the end I think this is just a bug with scatter's "jitter" argument.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeScatter Plots についてさらに検索

製品


リリース

R2016a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by