help-octave
[Top][All Lists]
Advanced

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

setting 'color' for a plot with multiple lines


From: indium
Subject: setting 'color' for a plot with multiple lines
Date: Sun, 20 Jan 2013 20:58:45 +0000
User-agent: Mutt/1.5.20 (2009-06-14)

Dear all,

I want to set the colors to some standard without cycling through each of them 
manually or via a for-loop.

The following script show my attempt and I do not understand why the last one 
doesn't work.
(some plot() commands are commented to not let Octave stop at it).

Can someone explain why the bottom plot() command doesn't work when I feed it a 
proper cell?

--------------------------------------------------

x=[linspace(0,2,30)' , linspace(0,2,30)'];
y=x;
y(:,1)=sin(x(:,1));
y(:,2)=cos(x(:,2));

figure
p=plot(x,y);
standardcolors=get(p,'color')
% this works, but the colors are not what I want

figure
K=rainbow(size(y)(2));
%p=plot(x,y,'color',K);
%% this doesn't work. Because K is a matrix?                                    
                                                                                
                        

figure
KK=mat2cell(K,ones(1,size(K)(1)),3)
whos standardcolors KK

%plot(x,y,'color',KK)
% why doesn't this work?

figure
p=plot(x,y)
get(p,'color')
set(p,'color',KK)

--------------------------------------------------

many thanks,

indium


reply via email to

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