How can I do a scatter plot with different color and symbols
    9 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
    Riyadh Muttaleb
 il 8 Dic 2020
  
    
    
    
    
    Risposto: Riyadh Muttaleb
 il 9 Dic 2020
            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;
scatter(X,Y,[],Z2,'b','filled','c')
however it hasn't worked
Any help,
Thanks in advance!
Riyadh
0 Commenti
Risposta accettata
  Cris LaPierre
    
      
 il 8 Dic 2020
        X = 0:4;
Y = 5:9;
Z = [ -1 2 -3 4];
ind = Z>=0;
scatter(X(ind),Y(ind),'r','filled','d'); 
hold on
scatter(X(~ind),Y(~ind),'b','filled','c')
hold off
6 Commenti
Più risposte (1)
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!


