Monday, March 05, 2007

[Matlab] Plot lines with different markers

Source

Matlab Help:
  • Find "LineSpec" to see the available markers

Codes

% Initialize a set of desired markers
MarkerSet = 'x*o+s.^v';
plot( x, y ); grid on;
% Obtain all line handles under current axes handle
hdl = findobj(gca,'Type','line');
for k=1:length(hdl)
% Assign markers to each line handle
set(hdl(k), 'marker', MarkerSet(k) );
end

No comments: