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

Reinaldo rei.listas at yahoo.com
Thu Jun 18 16:58:05 CEST 2015


Hi Jean,
Thanks for your answer. This solves my problem!
I reckon Scilab is an excellent and powerful mathematical software. However, it requires a medium/deep knowledge of programming to solve a simple problem.
For example: To change some basic parameters such as: x- and y-ticks, the Scilab users need to program some tens of (complex) code instructions:
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; 


Why hasn't Scilab got a single code to change x- and y- parameters (e.g., a.x_ticks=[-12:1:12] and a.y_ticks=[-0.4:.1:1])? This could be easier for Scilab users and makes the script be compact!

Furthermore, if I don't use the code: a.tight_limits = "on" the y-axis range is from -0.4 to 1; however, if I use it, the y-axis range changes to -0.2 to 1. Why? 
In addition, how could I change the y-axis range (i.e., y_min and y_max)?

Thank you in advance.
All best,Reinaldo.

      De: jbaudais [via Scilab / Xcos - Mailing Lists Archives] <ml-node+s994242n4032451h8 at n3.nabble.com>
 Para: Reinaldo <rei.listas at yahoo.com> 
 Enviadas: Terça-feira, 16 de Junho de 2015 5:04
 Assunto: Re: How can I change the x_ticks and y_ticks?
   
 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

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
 
 
   If you reply to this email, your message will be added to the discussion below: http://mailinglists.scilab.org/Scilab-users-How-can-I-change-the-x-ticks-and-y-ticks-tp4032449p4032451.html   To start a new topic under Scilab users - Mailing Lists Archives, email ml-node+s994242n2602246h53 at n3.nabble.com 
 To unsubscribe from Scilab users - Mailing Lists Archives, click here.
 NAML 





--
View this message in context: http://mailinglists.scilab.org/Scilab-users-How-can-I-change-the-x-ticks-and-y-ticks-tp4032449p4032474.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20150618/1fa59e4e/attachment.htm>


More information about the users mailing list