[Scilab-users] How can I change the x_ticks and y_ticks?

jbaudais@insa-rennes.fr Jean-Yves.Baudais at insa-rennes.fr
Tue Jun 16 09:52:34 CEST 2015


Hello,

Le 16/06/2015 02:12, Reinaldo a écrit :
> How could I change the x_ticks and y_ticks?
> For example: In this following script, the x_ticks displays each 2 units on X axis. I'd like each 0.5; and the y_ticks displays each 0.2 units on Y axis. I'd like each 0.1. How could I change those parameters?
> function f=myfunction(x)
> f = sin(x)./x
> endfunction
>
> // Plot
> scf(1);
> clf(1);
> xdata = linspace ( -12, 12, 100 );
> ydata = myfunction ( xdata );
> plot ( xdata , ydata );
> a=gca(); // obtendo o manipulador dos eixos correntes
> a.grid=[1 1];
> xlabel("X","fontsize",4,"color","red");
> ylabel("Y","fontsize",4,"color","red");Thank you in advance.
> All best,Reinaldo.



For example, you could use

function f=myfunction(x)
f = sin(x)./x
endfunction

// Plot
scf(1);
clf(1);
xdata = linspace ( -12, 12, 100 );
ydata = myfunction ( xdata );
plot ( xdata , ydata );
a=gca(); // obtendo o manipulador dos eixos correntes
a.tight_limits = "on";
a.grid=[1 1];
xlabel("X","fontsize",4,"color","red");
ylabel("Y","fontsize",4,"color","red");
tmp=a.x_ticks;
tmp.locations=[-12:12]';
tmp.labels=string(tmp.locations);
a.x_ticks=tmp;
tmp=a.y_ticks;
tmp.locations=[-0.4:.1:1]';
tmp.labels=string(tmp.locations);
a.y_ticks=tmp;


See
https://groups.google.com/forum/#!topic/comp.soft-sys.math.scilab/W2NwNbnys_I/discussion
but I'm not sure that's the good link...

-- Jean-Yves




More information about the users mailing list