[scilab-Users] tics

Adrien Vogt-Schilb vogt at centre-cired.fr
Fri Feb 24 18:56:39 CET 2012


On 24/02/2012 17:22, grivet wrote:
> 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;

Hi

you should modify labels and locations at the same time.
try something like this:

myticks = a.x_ticks
myticks.labels = ticxl;
myticks.locations = ticx;

a.x_ticks = myticks

(same thing for y)

>
> 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
>
>
>
>
> -- 
> To unsubscribe from this mailing-list, please send an empty mail to
> users-unsubscribe at lists.scilab.org
> To check the archives of this mailing list, see
> http://mailinglists.scilab.org/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20120224/a1ca2164/attachment.htm>


More information about the users mailing list