tics

grivet grivet at cnrs-orleans.fr
Fri Feb 24 17:22:50 CET 2012


Hi,
Using Scilab 5.3.2 under WinXP/SP3, I have been trying to plot the sine 
function in various ways and I can't manage to get the tiicks the way I 
want.
My first attempt
.
subplot(2,2,1);
plot2d(t,y,style=3,nax=[0,6,0,11]);
a=gca();
a.axes_visible="on";
a.box="on";
a.x_location="origin";
a.data_bounds=[0,-1;5,1];

The x axis is properly labelled but, on the y axis, I get ugly labels 
like 0.257, 0.411, etc; this is true whatever my choice of Ny..
If I don't use nax, labels are reasonable, but too close together.

My seconde attempt

ticy = -1:0.2:1;
ticyl = string(ticy);
ticx = 0:5;
ticxl = string(ticx);
subplot(2,2,1);
plot2d(t,y,style=3);
a=gca();
a.axes_visible="on";
a.box="on";
a.x_location="origin";
a.data_bounds=[0,-1;5,1];
a.x_ticks.locations=ticx;
a.x_ticks.labels=ticxl;
a.y_ticks.locations=ticy;
a.y_ticks.labels=ticyl;

This stops with the error message
   !--error 15
Sous-matrice incorrectement définie.
at line      42 of function generic_i_h called by :
at line       2 of function %s_i_h called by :
a.x_ticks.locations=ticx;

If I ask what ticx is, I get
-->ticx
  tic1x =
     0.    1.    2.    3.    4.    5.

whereas
-->ticy
  ticy  =
          column 1 to 8
   - 1.  - 0.8  - 0.6  - 0.4  - 0.2    0.    0.2    0.4
          column  9 to 11
     0.6    0.8    1.

It seems that ticx and ticy are not of the same nature. If I do ticx = 
0:0.5:5, the code works perfectly, but my labels are crowded..

I would be grateful for any suggestion on how to label axes conveniently.
Thank you for your time and help
JP Grivet






More information about the users mailing list