Scatter multiple table rows above same X-axis value

I have a table with 5 columns. How can I for each column, scatter all contents above same X-axis value corresponding to that column?

回答 (1 件)

Star Strider
Star Strider 2022 年 8 月 24 日

0 投票

Try this —
M = [1859 25.7 25.4; 1860 25.7 23.6; 1861 24.9 26.3];
figure
scatter(M(:,1), M(:,[2 3]), 'filled')
grid
xlim(xlim+[-1 1])
Make appropriate changes to get the result you want.
.

4 件のコメント

Ioannis
Ioannis 2022 年 8 月 24 日
Thanks!
Do you maybe know how to do the same in R2018b release?
Star Strider
Star Strider 2022 年 8 月 24 日
My pleasure!
That should work in R2018b. Are you getting a different result?
Ioannis
Ioannis 2022 年 8 月 24 日
I tried it and i get an
Error using scatter (line 78)
X and Y must be vectors of the same length.
Star Strider
Star Strider 2022 年 8 月 24 日
I no longer have access to R2018b. It may only want a pair of vectors at a time.
Perhaps this instead —
M = [1859 25.7 25.4; 1860 25.7 23.6; 1861 24.9 26.3];
figure
hold on
for k = 1:size(M,2)-1
scatter(M(:,1), M(:,k+1), 'filled')
end
hold off
grid
xlim(xlim+[-1 1])
.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeLabels and Annotations についてさらに検索

タグ

質問済み:

2022 年 8 月 24 日

コメント済み:

2022 年 8 月 24 日

Community Treasure Hunt

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

Start Hunting!

Translated by