Return to Snippet

Revision: 19732
at February 5, 2011 02:33 by benjamin


Updated Code
linestyles = cellstr(char('-',':','-.','--','-',':','-.','--','-',':','-',':',...
'-.','--','-',':','-.','--','-',':','-.'));

MarkerEdgeColors=jet(n);  % n is the number of different items you have
Markers=['o','x','+','*','s','d','v','^','<','>','p','h','.',...
'+','*','o','x','^','<','h','.','>','p','s','d','v',...
'o','x','+','*','s','d','v','^','<','>','p','h','.'];

% [...]

figure
hold on
for i=1:n
  plot(X(i,:), Y(i,:),[linestyles{i} Markers(i)],'Color',MarkerEdgeColors(i,:));
end

Revision: 19731
at October 29, 2009 16:03 by benjamin


Initial Code
linestyles = cellstr(char('-',':','-.','--','-',':','-.','--','-',':','-',':',...
'-.','--','-',':','-.','--','-',':','-.'));

MarkerEdgeColors=['r','c','b','k','g','m','y',...
'b','m','k','c','g','r','b','m','k','c','g',...
'r','c','b','k','g','m','r','b','m','k','c','g','r'];
Markers=['o','x','+','*','s','d','v','^','<','>','p','h','.',...
'+','*','o','x','^','<','h','.','>','p','s','d','v',...
'o','x','+','*','s','d','v','^','<','>','p','h','.'];

% [...]

figure
hold on
for i=1:n
plot(X(i,:), Y(i,:),[linestyles{i} Markers(i) MarkerEdgeColors(i)]);
end

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

Initial Description
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.

Initial Title
line styles, colors, markers in matlab

Initial Tags
style, line, color

Initial Language
MatLab