How to improve the basic bodeplot provided by SCILAB?

Hello,

I am trying to “improve” the bode plot provided by SCILAB.
It is easy to customize the first plot (Magnitude plot) as you can see on the plot below:

But I can’t access the second plot which remains desperately “greyish”.

Is it possible to do this? If anyone has a solution, I’d be delighted.

Below is my code.
As you can see, the curve 2 is not accessible: the instruction curve2=a.children.children(2); returns an “invalid index” error in the console.
I tried a lot various combinations without any success.

// How to improve the basic bodeplot provided by SCILAB?

clear;clc;

num = 1; // numérateur de la fonction de transfert
den = poly([1 0.05 1],'p','c'); // denominateur de la fonction de transfert
//Variante : den = (1 + 0.005*p + p^2);
H_p = syslin('c',num,den)// voilà c’est fait
clf();
bode(H_p,0.01,5,"$\frac{1}{1+0.05p + p^2}$");
xgrid(2,1,7);

title('.    Improved Bode Plot    .');
title font_style 9;//helvetica bold italic
title color blue;
title font_size 3;
title edgecolor blue;
title backgroundcolor gray80;

fig=gcf();
fig.background=color('gray60');
fig.figure_size = [800,800];

a=gca();
a.background=color('lightgray');//Magnitude plot improvement


//setting Magnitude curve improvements
curve1=a.children.children(1);//set curve appearance
curve1.foreground=color('red');//curve color
curve1.thickness=2;//curve thickness


//setting Phase curve improvements --> doesn't work
curve2=a.children.children(2);//set curve appearance
curve2.foreground=color('red');//curve color
curve2.thickness=2;//curve thickness

Thanks in advance to whoever has the solution
Pascal

Hello,

Each subplot has its own Axes. By calling gca() after bode() you get the latest subplot that has been created. To access the two subplots you have to get the subplot Axes like this

a=findobj(gcf(),"type","Axes")

then a(1) and a(2) are your two subplot axes. BTW, I think that the gray background does not improve the bode plot…

S.

Thank you very much Stéphane.
I would never have found this trick on my own.
Thats works fine beyond my expectations !

Here is the new code with my peronnal customization. I kept the gray background for the plots. Of course, it is very easy to change it.

Still, the result is more attractive than the original.

// How to improve the basic bodeplot provided by SCILAB?

clear;clc;

num = 1; // num of transfer function
den = poly([1 0.05 1],'p','c'); // denom of transfer function
//Variant : den = (1 + 0.005*p + p^2);
H_p = syslin('c',num,den)// voilà that's done!

clf();
bode(H_p,0.01,5,"$\frac{1}{1+0.05p + p^2}$");//basic bode instruction

//Writing a title
title('.    Improved Bode Plot    .');
title font_style 9;//helvetica bold italic
title color blue;
title font_size 3;
title edgecolor blue;
title backgroundcolor gray80;

//setting the plots figure
fig=gcf();
fig.background=color('gray80');// background color surrounding both plots
fig.figure_size = [800,800];

//Axis improvements
a=findobj(gcf(),"type","Axes")// allow to access 2 embedded subplots within the bode construction
//We get a(1) corresponding at the phase plot and a(2) at the magnitude plot

//Axis Phase plot (numbered 1) improvements
a(1).background=color('gray60');//Background color of  phase plot
a(1).grid_style = [7,7];//Customizing the grid (in x and y direction) : 7 = small dots
a(1).grid = [9,9];//Customizing the grid (in x and y direction) : 9 ="dark blue" in the default colormap
a(1).font_size = 2;
a(1).font_color = 2;

//Axis Magnitude plot (numbered 2) improvements
a(2).background=color('gray60');//Background color of magnitude plot
a(2).grid_style = [7,7];
a(2).grid = [9,9];
a(2).font_size = 2;
a(2).font_color = 2;

//setting Magnitude curve improvements (numbered 2)
curve2=a.children.children(2);//set curve 2 appearance
curve2.foreground=color('blue');//curve color
curve2.thickness=2;//curve thickness


//setting Phase curve improvements (numbered 1)
curve1=a.children.children(1);//set curve 1 appearance
curve1.foreground=color('blue');//curve color
curve1.thickness=2;//curve thickness


The figure: