Changing the colour of lines on a graph
    4 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
    callum connacher
 le 3 Oct 2017
  
    
    
    
    
    Réponse apportée : Image Analyst
      
      
 le 3 Oct 2017
            I have the following code that produces a graph with 17 lines.
for i=1:length(Serie)
    x=StrainSave{i};
    y=StressSave{i};
    plot(x,y,'k');
    title('Stress V Strain');
    xlabel('\epsilon [%]');
    ylabel('\sigma [MPa]');
    legend('Test1','Test2','Test3','Test4','Test5','Test6','Test7','Test8','Test9','Test10','Test11','Test12','Test13','Test14','Test15','Test16','Test17','location','southeast');
    hold off;
endI am wanting the data of Test 6 to stand out. So I am wondering how it would be possible for me to have the line for test 6 in red and keep the rest in black?
0 commentaires
Réponse acceptée
  Image Analyst
      
      
 le 3 Oct 2017
        Try this:
if i == 6
    plot(x,y,'r', 'MarkerSize', 10, 'LineWidth', 2); % Plot marker in red.
else
    plot(x,y,'k');
end
0 commentaires
Plus de réponses (0)
Voir également
Catégories
				En savoir plus sur Line Plots dans Help Center et File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

