xaxis

xaxis — draw an axis

Calling sequence

xaxis(alpha,nsteps,size,init)  

Parameters

alpha : real, slope in degree of the axis.
nsteps : real vector of size 2, number of big and small intervals.
size : real vector of size 3, size of the small intervals, and small and big tics.
init : real vector of size 2, origin of the axis.

Description

xaxis draws an axis.

The direction of the axis is given by alpha in degree.

init=[x0 y0] is the initial point of the axis.

nsteps=[n1,n2] gives the number of big and small intervals separated by tics.

size=[s1,s2,c1] where s1 gives the size of the small intervals, s2 gives the size of the small tics along the axis and s2*c1 gives the size of the big tics. All the sizes are given using the current x-scale and y-scale and are given as dimensions along the drawn axis.



            example : n1=3, n2=2, alpha=0
                    (s2*c1) 
            |     (s2)   |            |           |
            |______|_____|_____|______|_____|_____|
               s1
   
    

Examples



x=[-%pi:0.1:%pi]';
// plot without axis
plot2d(x,sin(x),1,"010"," ",[-4 -1 4 1])
// draw x axis
xpoly([-4 4],[0 0],"lines")
xaxis(0,[2 2],[2 0.1 3],[-4 0])
xstring(-4.1,-0.25,"-4"); xstring(-0.2,-0.1,"0"); xstring(4,-0.25,"4")
// draw y axis
xpoly([0 0],[-1 1],"lines")
xaxis(90,[2 2],[0.5 0.025 3],[0 1])
xstring(-0.5,-1.05,"-1"); xstring(-0.35,0.95,"1")
 
  

Author

J.Ph.C.