plot vector where negative data is circled
    6 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
    Toke Søltoft
 le 13 Mar 2015
  
    
    
    
    
    Réponse apportée : Toke Søltoft
 le 13 Mar 2015
            If I e.g. have the following two vectors:
   data = [1 2 3 -4 -5 6 -7 8 9 -10]
   pos = [1 2 3 4 5 6 7 8 9 10]
How can I do
plot(abs(data),pos)
set(gca,'xscale','log');
where only the negative data is circled? Is that even possible without stepping through each data point?
0 commentaires
Réponse acceptée
  Rick Rosson
    
 le 13 Mar 2015
        
      Modifié(e) : Rick Rosson
    
 le 13 Mar 2015
  
      isNeg = (data < 0);
plot(abs(data),pos)
hold on
plot(abs(data(isNeg)),pos(isNeg),'o')
set(gca,'xscale','log');
0 commentaires
Plus de réponses (1)
Voir également
Catégories
				En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange
			
	Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

