help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: different colours for different curves in the same plot


From: William Krekeler
Subject: RE: different colours for different curves in the same plot
Date: Tue, 31 May 2011 16:09:01 +0000

Federica

In reference to 
http://octave.1599824.n4.nabble.com/different-colours-for-different-curves-in-the-same-plot-tp3563544p3563544.html

You need to set the color property of each line. If you only have a few lines 
to plot then you can do the following.

% start pseudo-code

plotColor = 'brgkmcyw';
figure
for m = 1:length( ydata_sets )
   plot( xdata, ydata(m), sprintf( '%s', plotColor(m) ) )
end

% end pseudo-code

Or if you have a lot of data sets

% start pseudo-code
plotColors = colormap;
figure
for m = 1:length( ydata_sets )
   plotColorsI = round( size( plotColors, 1)* m / length(ydata_sets) );
   hold on   
   H1 = plot( xdata, ydata(m) )
   hold off
   set( H1,'Color', plotColors( plotColorsI,:) );
end
% end pseudo-code

Bill Krekeler


reply via email to

[Prev in Thread] Current Thread [Next in Thread]