[Scilab-users] {EXT} Curves color when plotting

Perrichon perrichon.pierre at wanadoo.fr
Tue Oct 22 09:02:55 CEST 2019


Hello,

 

Thanks you for your response

 

I mainly plot curves for bode, nyquist plans, et also time response curves  with csim.

 

With csim, curves are plotted using plot2d. So the problem is very easy to solve :

               simulation=csim(in, t, SYS_FTBF );

               plot2d(t' , [in' simulation'],rect=[0,ymin_Temp,tmax,ymax_Temp],style=TColor);

 

where TColor=[2 3 5 4 6 16 5 15];

I suppose that 2, 3 …are index in a Color Table by default.           

 

I have no solution to colorize curves with bode or nyquist, exept to acces to children(xx).foreground=TColot(i)

where i is the curve number.

 

That's what I wanted to avoid

 

Best regards

Pierre P.

 

De : users <users-bounces at lists.scilab.org> De la part de Chin Luh Tan
Envoyé : mardi 22 octobre 2019 04:48
À : Users mailing list for Scilab <users at lists.scilab.org>
Cc : Users mailing list for Scilab <users at lists.scilab.org>
Objet : Re: [Scilab-users] {EXT} Curves color when plotting

 

Hi,

 

from my understanding, easiest way to get the color you wanted is by specifying it during the plot function. 

--> plot(x,sin(x),'b')

--> plot(x,cos(x),'b')

will gives u 2 blue lines.

 

 

By default, scilab figure will following the sequence as stated in "help plot"

 

 

"A default color table is used to color plotted curves if you do not specify a color. When drawing multiple lines, the plot command automatically cycles through this table. Here are the used colors:"

 

R       G       B

0.      0.      1.

0.      0.5      0.

1.      0.      0.

0.      0.75  0.75

0.75  0.      0.75

0.75  0.75   0.

0.25  0.25   0.25

 

no matter what colormap you are changing to before the plot, the plot w/o color input will search for the "blue" in the newly define colormap as well. 

 

If the previous methods does not work for you, you could plot the graph, find the handle for the line, and change it according to the color index in the colormap for the figure.

 

plot(x,sin(x),x,cos(x))

f = gcf();

f.children.children.children.foreground

f.children.children.children.foreground(1) = 2;

 

this will change the second line to blue, as the default colormap f.colormap define blue in the second row. (f.color_map)

 

hope this helps.

 

rgds,
CL

 

---- On Mon, 21 Oct 2019 18:41:09 +0800 Dang Ngoc Chan, Christophe <Christophe.Dang at sidel.com <mailto:Christophe.Dang at sidel.com> > wrote ----

 

Hello Pierre, 

> De : Perrichon 
> Envoyé : lundi 21 octobre 2019 12:05 
> 
> Generally, when plotting, curves's color are taken in the range color 
> [1 3 5 7 9 11 13 15 [...] Is there a general way to modify this vector 
> as to get another one with blue as first curve. 

You might consider redefining the colour map: 

https://help.scilab.org/docs/6.0.2/en_US/colormap.html 

Hope this helps, 

regards 

-- 
Christophe Dang Ngoc Chan 
Mechanical calculation engineer 

General 
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error), please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. 
_______________________________________________ 
users mailing list 
users at lists.scilab.org <mailto:users at lists.scilab.org>  
http://lists.scilab.org/mailman/listinfo/users 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20191022/6d9c968a/attachment.htm>


More information about the users mailing list