Different coloured markers based on values

I have values to be plotted that range from 0 to 0.1 and i would like the markers of the values less than 0.05 be box markers filled in black, while the ones larger than 0.05 only have a highlighted black border. Is there a way without seperating the values into two seperate matrices and plotting them individually?

 採用された回答

Adam Danz
Adam Danz 2020 年 6 月 8 日

2 投票

Use indexing. Create a logical array the same size as your data that identifies values < 0.05.
idx = x < 0.05;
Then you can plot the two populations of data separately.
plot(x(idx), 'ks','MarkerFaceColor', 'k');
hold on
plot(x(~idx), 'ks')

その他の回答 (1 件)

KSSV
KSSV 2020 年 6 月 8 日

2 投票

YOu have to use logical indexing. USe ineualities and plot them.
figure
hold on
plot(x(y<0.05),y(y<0.05),'sr')
plot(x(y>=0.05),y(y>=0.05),'ob')

カテゴリ

ヘルプ センター および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

製品

リリース

R2019b

質問済み:

2020 年 6 月 8 日

回答済み:

2020 年 6 月 8 日

Community Treasure Hunt

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

Start Hunting!

Translated by