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: marco atzeri
Subject: Re: different colours for different curves in the same plot
Date: Thu, 2 Jun 2011 08:38:23 +0200

On Thu, Jun 2, 2011 at 8:15 AM, Moo wrote:
> On Tue, May 31, 2011 at 9:59 AM, Federica
> wrote:
>>
>> Hi,
>>
>> I'm trying to represent several curves on the same plot using Octave 3.2.4
>> on Windows. The commands I used to have the unique plot and a relative
>> legend are:
>>
>> hold on;
>>   s=sprintf(";Lu= %d;",LU);
>> plot(t,m,s);
>>
>> hold off
>>
>> where m is the result of a differential equation systems. So I have
>> different curves for different m but using these commands I have only a
>> colour for all the curves. Also if I specify the color I have only the
>> specific color I chose and I have it for all the curves. How can I tell to
>> Octave to pick a different color for each curve?
>>
>> Thank you so much!!!!
>>
>> Federica
>
> I haven't looked very carefully at the previous suggestions, other than that
> they are all using loops.  I believe that is the best you can do if you want
> to specify colors.  If you don't care what the colors are for your plots,
> assuming you have x_data of size 1xN and y_data size MxN, where M is the
> number of solutions/whatever, you should be able to do
>
> plot(x_data,y_data)
>
> and Octave will automatically plot each solution separately in different
> colors.  I don't know how many colors it cycles through or the criteria for
> the colors chosen, but I thought I should point that out.
>

Hi Moo,
plot chose different colors (up to 6) if you specify all the data in
the same plot command

plot(x1_data,y1_data,x2_data,y2_data,x3_data,y3_data)

but she can not use it as the number of curves is not fixed.

but with

hold on
for i:1:n
  plot(x_data(i),yi_data(j))
endfor
hold off

all the curves have the same color, and this is the problem of Federica

Regards
Marco


reply via email to

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