Path: news.mathworks.com!not-for-mail
From: "salman " <salmanabdullah9@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Plotting multiple lines on the same graph, different color
Date: Mon, 17 Oct 2011 00:07:10 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 39
Message-ID: <j7frje$ldr$1@newscl01ah.mathworks.com>
References: <j7dm5k$35k$1@newscl01ah.mathworks.com> <j7e0dm$26s$1@newscl01ah.mathworks.com> <j7f0j3$3jc$1@newscl01ah.mathworks.com>
Reply-To: "salman " <salmanabdullah9@gmail.com>
NNTP-Posting-Host: www-03-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1318810030 21947 172.30.248.48 (17 Oct 2011 00:07:10 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 17 Oct 2011 00:07:10 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2784299
Xref: news.mathworks.com comp.soft-sys.matlab:746190

"Ulrik Nash" <uwn@sam.sdu.dk> wrote in message <j7f0j3$3jc$1@newscl01ah.mathworks.com>...
> "salman " <salmanabdullah9@gmail.com> wrote in message <j7e0dm$26s$1@newscl01ah.mathworks.com>...
> > "Ulrik Nash" <uwn@sam.sdu.dk> wrote in message <j7dm5k$35k$1@newscl01ah.mathworks.com>...
> > > Hi Everyone,
> > > 
> > > Suppose I have the following code, which plots different lines on a graph:
> > > 
> > > t = 1:timeperiods;
> > > for i = 1:num_files
> > >     plot(t,A(1:timeperiods,i))
> > >     hold all
> > >     plot(t,B(1:timeperiods,i))
> > > end
> > > 
> > > For each loop (i.e. for each pair of lines) I wish to change the colour of lines. How can I amend the code to do this?
> > > 
> > > Regards,
> > > 
> > > Ulrik.
> > for m=1:x
> > hold on
> > plot(t,y(m),'Color',rand(1,3)))
> > end
> 
> 
> I am sorry, but could you please answer within the context of my code?

 t = 1:timeperiods;
> > > for i = 1:num_files
hold on
> > >     subplot(211)
plot(t,A(1:timeperiods,i),'Color',rand(1,3))
subplot(212)
> > > > > >     plot(t,B(1:timeperiods,i),'Color',rand(1,3))
> > > end

you might see it separate on two subplots

i think this should do :)