[Scilab-users] Curves color when plotting

classic Classic list List threaded Threaded
9 messages Options
Pierre PERRICHON Pierre PERRICHON
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] Curves color when plotting

Dear all,

 

Generally, when plotting, curves’s color are taken in the range color [1 3 5 7 9 11 13 15], where 1 is the black color.

So, the first curve is black

 

Is there a general way to modify this vector as to get another one with blue as first curve.

I don’t search something like children(i).foreground=xxx, but a generic instruction to do when launching a sce or sci files

 

This possible in xcos, with a cscope where colors can be re-organized

Exemple in a cscope : [2 3 5 4 6 16 13 15]

 

Best Regards

 

Pierre P.

 


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Christophe Dang Ngoc Chan Christophe Dang Ngoc Chan
Reply | Threaded
Open this post in threaded view
|

Re: {EXT} Curves color when plotting

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
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Chin Luh Tan Chin Luh Tan
Reply | Threaded
Open this post in threaded view
|

Re: {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 <[hidden email]> 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
[hidden email]
http://lists.scilab.org/mailman/listinfo/users



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Pierre PERRICHON Pierre PERRICHON
Reply | Threaded
Open this post in threaded view
|

Re: {EXT} Curves color when plotting

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 <[hidden email]> De la part de Chin Luh Tan
Envoyé : mardi 22 octobre 2019 04:48
À : Users mailing list for Scilab <[hidden email]>
Cc : Users mailing list for Scilab <[hidden email]>
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 <[hidden email]> 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
[hidden email]
http://lists.scilab.org/mailman/listinfo/users

 

 


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Chin Luh Tan Chin Luh Tan
Reply | Threaded
Open this post in threaded view
|

Re: {EXT} Curves color when plotting


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 <[hidden email]> 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 <[hidden email]> De la part de Chin Luh Tan
Envoyé : mardi 22 octobre 2019 04:48
À : Users mailing list for Scilab <[hidden email]>
Cc : Users mailing list for Scilab <[hidden email]>
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 <[hidden email]> 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
[hidden email]
http://lists.scilab.org/mailman/listinfo/users

 

 

_______________________________________________
users mailing list










_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Pierre PERRICHON Pierre PERRICHON
Reply | Threaded
Open this post in threaded view
|

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

Hello CL

Thanks you for your response. It’s wise en relevant.

But yesterday, I’ve found 5 minutes ti program the children(x).foreground

Also thanks you for this nice conversation and exchange

 

 

 

Pierre P.

 

 

De : users <[hidden email]> De la part de Chin Luh Tan
Envoyé : mercredi 23 octobre 2019 02:02
À : Users mailing list for Scilab <[hidden email]>
Objet : Re: [Scilab-users] {EXT} Curves color when plotting

 

 

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 <[hidden email]> 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

 


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Chin Luh Tan Chin Luh Tan
Reply | Threaded
Open this post in threaded view
|

Re: TR: {EXT} Curves color when plotting

very nice chart, great you find your way. 

rgds,
CL


---- On Wed, 23 Oct 2019 18:44:40 +0800 Perrichon <[hidden email]> wrote ----

Hello CL

Thanks you for your response. It’s wise en relevant.

But yesterday, I’ve found 5 minutes ti program the children(x).foreground

Also thanks you for this nice conversation and exchange

 

 


 

Pierre P.

 

 

De : users <[hidden email]> De la part de Chin Luh Tan
Envoyé : mercredi 23 octobre 2019 02:02
À : Users mailing list for Scilab <[hidden email]>
Objet : Re: [Scilab-users] {EXT} Curves color when plotting

 

 

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 <[hidden email]> 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

 

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: {EXT} Curves color when plotting

In reply to this post by Pierre PERRICHON
Hello,

Le 22/10/2019 à 09:02, Perrichon a écrit :

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

There is no need to use an external loop on i:

// After the bode() 's first example:
curves = gcf().children.children.children;
curves.foreground = color("orange");
curves.thickness = 2;

// After the second bode()'s example :

curves = gcf().children.children.children
o = color("orange"); g = color("green");
curves.foreground = [o g o g];
curves.thickness = 2;


Using handles on curves looks more powerful than adding a style option to bode().
Handles enable tuning all the properties of curves, including their thicknesses, etc,
what would require several separate bode's options.
Also, handles allow to set properties of any subset of selected curves, while in options
a special value would be required to tell "do not change the value for this curve".

However, after calling bode(), we could expect that gce() returns
curves = gcf().children.children.children
while presently bode() does not set gce() at all.
This wish would deserve a post in bugzilla.

For the Nyquist plot: presently, addressing graphical elements is more complex.

Regards
Samuel

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: Curves color when plotting

In reply to this post by Pierre PERRICHON
Le 21/10/2019 à 12:04, Perrichon a écrit :

Dear all,

 

Generally, when plotting, curves’s color are taken in the range color [1 3 5 7 9 11 13 15], where 1 is the black color.

So, the first curve is black

 

Is there a general way to modify this vector as to get another one with blue as first curve.


cm = gdf().color_map;
gdf().color_map(1:2,:) = cm([2 1],:);

But then, in all forthcoming graphical figures, blue and black colors of the default color map will be switched, for all kinds of plots.
Not sure that's a good idea.



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users