Different coloured markers based on values

32 views (last 30 days)
Ahmed Abdulla
Ahmed Abdulla on 8 Jun 2020
Answered: KSSV on 8 Jun 2020
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?

Accepted Answer

Adam Danz
Adam Danz on 8 Jun 2020
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')

More Answers (1)

KSSV on 8 Jun 2020
YOu have to use logical indexing. USe ineualities and plot them.
hold on




Community Treasure Hunt

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

Start Hunting!

Translated by