How to plot negative values with scatter in different color?
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
What I have are x and y values which I then use to generate z as a peak function. So z is basically a matrix with negative and positive values. What I want to now is to have the negative values in a different color as the positive values.
h=scatter(x,y,z,C);
Does anyone know how to do this?
What I tried before is this: if y>0 h=scatter(x,y,z,'bo'); else y=abs(y); h=scatter(x,y,z,'ro'); end
But this obviously checks the Matrix as a whole and only plots one of the two cases and not every point from the Matrix individually.
1 Commento
Suraj Mankulangara
il 23 Feb 2018
It looks like you are trying to create a 3D scatter plot, in which case you might want to use the scatter3() function
So basically, what you are trying to do is, for the points in matrix y that correspond to negative values, the scatter plot of z should be in one color, and for points in y that are positive, the scatter plot of z should be in another color ?
Risposte (0)
Vedere anche
Categorie
Scopri di più su Scatter Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!