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

Chin Luh Tan chinluh.tan at bytecode-asia.com
Wed Oct 23 02:01:42 CEST 2019


Hi,



I see. In his case, since Scilab is open source, I think the best way is to edit the plot to suit to your need. 



for example, you can edit the bode function, add extra line to line 125 and 155



// Set datatips info
124 e = gce();
125 e.children.foreground = tcolor(1);  <-- extra line
126 for i=1:size(e.children, "*")

154 ephi = gce();
155 ephi.children.foreground = tcolor(2) <-- extra line
// Set datatips info
for i=1:size(ephi.children, "*")

and the header



bode(tcolor, varargin)

so you can call the bode by:



bode([2,5],h, 0.01, 100);



and get








then you goto the SCI\modules\cacsd\macros\ , run buildmacros.sce to make it permanent. 





CL





---- On Tue, 22 Oct 2019 15:02:55 +0800 Perrichon <mailto:perrichon.pierre at wanadoo.fr> wrote ----



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 <mailto: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 <mailto:users at lists.scilab.org>
Cc : Users mailing list for Scilab <mailto: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 <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 
mailto:users at lists.scilab.org 
http://lists.scilab.org/mailman/listinfo/users



 



 



_______________________________________________ 

users mailing list 

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/20191023/b0d60b2b/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1571788895263000_1830334563.png
Type: image/png
Size: 52824 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20191023/b0d60b2b/attachment.png>


More information about the users mailing list