line styles, colors, markers in matlab


/ Published in: MatLab
Save to your folder(s)

This script is for generating plots with many curves, where each curve has its own marker, color, and line style. Please see my blog post for more explanations and leave comments there.


Copy this code and paste it in your HTML
  1. linestyles = cellstr(char('-',':','-.','--','-',':','-.','--','-',':','-',':',...
  2. '-.','--','-',':','-.','--','-',':','-.'));
  3.  
  4. MarkerEdgeColors=jet(n); % n is the number of different items you have
  5. Markers=['o','x','+','*','s','d','v','^','<','>','p','h','.',...
  6. '+','*','o','x','^','<','h','.','>','p','s','d','v',...
  7. 'o','x','+','*','s','d','v','^','<','>','p','h','.'];
  8.  
  9. % [...]
  10.  
  11. hold on
  12. for i=1:n
  13. plot(X(i,:), Y(i,:),[linestyles{i} Markers(i)],'Color',MarkerEdgeColors(i,:));
  14. end

URL: http://www.myoutsourcedbrain.com/2009/03/line-styles-in-matlab.html

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.