How can I do a scatter plot with different color and symbols

24 views (last 30 days)
Hi Everyone,
I want to plot scatter plot with diffrent symboles and color for my posative and negative data,
I have:
X: vector
Y vector
Z:[ -1 2 -3 4] so I made it:
Z1[NaN 2 Nan 4]
z2[-1 NaN -3 NaN]
I used:
scatter(X,Y,[],Z1,'r','filled','d'); hold on;
however it hasn't worked
Any help,
Thanks in advance!

Accepted Answer

Cris LaPierre
Cris LaPierre on 8 Dec 2020
X = 0:4;
Y = 5:9;
Z = [ -1 2 -3 4];
ind = Z>=0;
hold on
hold off
Riyadh Muttaleb
Riyadh Muttaleb on 9 Dec 2020
I don't know how to attach the code and data, however, assume I have these data.
I want to make color and symble for -ve , +ve and NaN (OR zero something diffrent)
X = 0:6;
Y = 5:11;
Z = [ -1 2 -3 4 NaN NaN];

Sign in to comment.

More Answers (1)

Riyadh Muttaleb
Riyadh Muttaleb on 9 Dec 2020
I did it!
thank you so much for your time and help!


Community Treasure Hunt

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

Start Hunting!

Translated by