[Scilab-users] Plotting a graph ...

Dang, Christophe Christophe.Dang at sidel.com
Tue Sep 30 11:23:33 CEST 2014


Hello,

> De Quentin Mazué
> Envoyé : mardi 30 septembre 2014 08:47
>
>> De Reinaldo
>> Envoyé : mardi 30 septembre 2014 04:00
>>
>> How could I set y-axis from -1 to 9?
> //Change the range of the Y axis
> a=get("current_axes");//get the handle of the newly created axes
> a.data_bounds=[-5,-1;5,9];//New bounds

Indeed, in Scilab,
you should become familiar with handles
which allow the "fine tuning" of a lot of things.

> In addition, how could I change the colors of following functions f(x), g(x) and h(x)?

In the same way as Quentin told you,
you have to get the handle of the drawings (polylines)
with something like

h = gce() // get current entity

please have a look at

http://help.scilab.org/docs/5.5.0/en_US/gce.html

http://help.scilab.org/docs/5.5.0/en_US/polyline_properties.html

This can somtimes be a bit tricky.
First of all, h = gce() should be placed right after plot(...).
And in your case, gce() points to a "compound",
which child is a matrix containing the three polylines.

To get familiar with it, you should try in the console

// **********

plot ( xdata , [ydata1; ydata2; ydata3]);

h = gce();

h.children

h.children(1)

h.children(1).foreground = 0; // turns the first curve to black

// **********

The colours are refered by numbers,
and you can have the correspondance table with

getcolor()

> legend("f(x) = x^3-3x", "g(x) = -x","h(x) = -x^2");
> // <- How could I show correctly the exponentials of those polinomial functions?

In the same way as you did for xlabel: enclose it inside $...$

HTH

Regards

--
Christophe Dang Ngoc Chan
Mechanical calculation engineer
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.



More information about the users mailing list