Reputation: 7890
I have a large data
matrix with 5 columns. 5th column contains many zeros. I want to do scatter(data(:,4),data(:,5))
and set a different color for points/rows where value in 5th column is zero.
I will then draw scatter plot of different columns but with same condition i.e. different color where values in 5th column are zeros.
Upvotes: 1
Views: 2474
Reputation: 371
You can easily set the different color-flag as a fourth parameter in a function:
scatter(d(:,4), d(:,5), 7, d(:,5)==0);
Here d(:,4)
and d(:,5)
are the coordinates of points, 7
is the size of the point, and d(:,5)==0
is the color-flag (for different values of d(:,5)
, different colors are chosen).
Upvotes: 2