2 Graphic Library
2.1 Graphics Graphic library for Scilab
DESCRIPTION :
GENERAL PLOTTING
plot3d: 3d plotting of a matrix of point.
plot3d1: 3d plotting of a matrix of point with gray levels.
fplot3d: 3d plotting of a surface described by a function
fplot3d1: 3d plotting of a surface described by a function with gray levels
plot2d: for 2d plotting plot2d1,plot2d2,plot2d3,plot2d4
fplot2d: 2d plotting of a a curve described by a function
errbar: adds error bars on a plot2d graphic
xgrid: adds a grid on a 2d graphic.
xtitle: adds title and axis names on a 2d graphic
param3d: plots curves in 3d space
stair2d: 2d piece-size constant plotting.
champ: vector field in R2
fchamp: for a vector field in R2 defined by a function
contour: level curves for a 3d function given by a matrix.
grayplot10: gray level on a 2d plot
fcontour10: level curves for a 3d function given by a function.
fgrayplot10: gray level on a 2D plot
xchange: scale conversion between plot2d and pixels
gr_menu: small interactive editor
hist3d: 3d histogram
xrpoly: graphic display of a regular polygon
titlepage: graphic title page
POLYLINES PLOTTING
xpoly: draws a polyline
xpolys: draws a set of polylines
xfpoly: fills a polygon
xfpolys: fills a set of polygons
SEGMENTS PLOTTING
xsegs: draws a set of unconnected segments.
ARROWS PLOTTING
xarrows: draws a set of unconnected arrows.
RECTANGLES PLOTTING
xrect: draws a single rectangle
xfrect: fills a single rectangle
xrects: fills or draws a set of rectangles
ARCS PLOTTING
xarc : draws an ellipsis
xfarc: fills an ellipsis
xarcs: fills or draws a set of ellipsis.
STRINGS
xstring: draws a string or a matrix of strings.
xstringl: computes a rectangle which surrounds a string
xstringb: draws a string in a specified box
xnumb: draws a set of numbers
AXIS DRAWING
xaxis: draws an axis.
UTILITIES
secto3d: Conversion of a surface description from sector to plot3d compatible data.
eval3d: evaluates a function on a regular grid. (see also feval)
COORDINATES TRANSFORMS
isoview: isometric scale.
square: isometric scale.
scaling: scaling on datas
rotate: rotation
xgetech,xsetech: change of scale inside the graphic window (not fully released).
RECORDING
xtape: record graphic instructions
PRINTING AND REDISPLAY
xbasc: clears window and recorded graphics
xbasimp: redisplays graphics to postscript printer
xbasr: redisplays graphics
GRAPHICS PRIMITIVES
X-window and Postscript graphic primitives
driver: to select a graphic driver
xinit: to initialise a graphic driver
xclear: clears one or more graphic windows
xpause: a pause in milliseconds.
xselect: raises the current graphic window.
xclick: waits for a mouse click
xclea: clears a rectangular zone inside the current graphic window.
xend : closes a graphic session.
GRAPHIC CONTEXT
xset : to set graphic context values
xget : to get information on the current graphic context
xlfont: to load a new family of fonts from the X-Window Manager
COLORS
colormap : to get information on using colors
addcolor : to add new colors in the colormap
Author :
J.Ph C
2.2 Matplot 2D plot of a matrix using colors
CALLING SEQUENCE :
Matplot(A,[strf,rect,nax])
PARAMETERS :
- A
: real matrix of size (n1,n2).
- strf,rect,nax
: optional arguments, ( see plot2d)
DESCRIPTION :
The entries of matrix int(A) are used as colormap entries in
the current colormap. The color associated to a(i,j) is used
do draw a small square of length 1 and with center at location (x=j,y=(n2-i+1)).
Enter the command Matplot() to see a demo.
EXAMPLE :
Matplot([1,2,3;4,5,6])
// draw the colormap
Matplot((1:xget("lastpattern")))
See Also :
grayplot
X
Author :
J.Ph.C..
2.3 Sfgrayplot 2D plot with gray levels
CALLING SEQUENCE :
Sfgrayplot(x,y,f,[strf,rect,nax])
DESCRIPTION :
Like fgrayplot but the function fec is used to smooth the
result. f is evaluated on the grid x.*.y and the result is plotted assuming that f is linear on the triangles built on the x.*.y grid. Enter Sfgrayplot() to see a demo.
______
| /| /|
|/_|/_|
| /| /|
|/_|/_|
EXAMPLE :
Sfgrayplot()
Author :
J.Ph.C..
See Also :
Sgrayplot
X, fgrayplot
X, grayplot
X, fec
X
2.4 Sgrayplot 2D plot of a surface using gray levels
CALLING SEQUENCE :
Sgrayplot(x,y,z,[strf,rect,nax])
DESCRIPTION :
Like grayplot but the function fec is used to smooth the
result. z gives the value of the function on the grid x.*.y .
The function is plotted assuming that it is linear on a set triangles of
triangles built from the grid. Type Sgrayplot() to see a demo
______
| /| /|
|/_|/_|
| /| /|
|/_|/_|
EXAMPLE :
Sgrayplot()
See Also :
Sfgrayplot
X, fgrayplot
X, grayplot
X, fec
X
Author :
J.Ph.C..
2.5 addcolor add new colors to current colormap
CALLING SEQUENCE :
new=addcolor(c)
PARAMETERS :
- c
: matrix with 3 column, RGB color definition
- new
:
index of the colors defined in c in the new color table
DESCRIPTION :
addcolor, adds new colors given in the c argument to
current colormap. c must be a matrix with 3 columns
[R G B] (R is red component, G is green component,
B is blue component). Each entry in c must be a non
negative number less or equal to 1.
If a color defined in c is already present in current colormap
it is not added.
See Also :
colormap
X
2.6 black Black's diagram (Nichols chart)
CALLING SEQUENCE :
black( sl,[fmin,fmax] [,step] [,comments] )
black( sl,frq [,comments] )
black(frq,db,phi [,comments])
black(frq,repf [,comments])
PARAMETERS :
- sl
: list ( linear system syslin)
- fmin,fmax
: real scalars (frequency bounds)
- frq
: row vector or matrix (frequencies)
- db,phi
: row vectors or matrices (modulus, phase)
- repf
: row vectors or matrices (complex frequency response)
- step
: real
- comments
: string
DESCRIPTION :
Black's diagram (Nichols'chart) for a linear system sl.
sl can be a continuous-time or discrete-time SIMO system (see syslin).
In case of multi-output the outputs are plotted with different
symbols.
The frequencies are given by the bounds fmin,fmax (in Hz) or by a row-vector
(or a matrix for multi-output) frq.
step is the ( logarithmic ) discretization step. (see calfrq for the
choice of default value).
comments is a vector of character strings (captions).
db,phi are the matrices of modulus (in Db) and phases (in degrees).
(One row for each response).
repf matrix of complex numbers. One row for each response.
To plot the grid of iso-gain and iso-phase of y/(1+y) use chart().
Default values for fmin and fmax are
1.d-3, 1.d+3 if sl is continuous-time
or 1.d-3, 0.5 if sl is discrete-time.
EXAMPLE :
s=poly(0,'s')
h=syslin('c',(s^2+2*0.9*10*s+100)/(s^2+2*0.3*10.1*s+102.01))
chart();
sstr='(s^2+2*0.9*10*s+100)/(s^2+2*0.3*10.1*s+102.01)';
black(h,0.01,100,sstr);
h1=h*syslin('c',(s^2+2*0.1*15.1*s+228.01)/(s^2+2*0.9*15*s+225))
xbasc()
black([h1;h],0.01,100,['h1';'h'])
See Also :
bode
X, nyquist
X, chart
X, freq
X, repfreq
X, calfrq
X, phasemag
X
2.7 bode Bode plot
CALLING SEQUENCE :
bode(sl,[fmin,fmax] [,step] [,comments] )
bode(sl,frq [,comments] )
bode(frq,db,phi [,comments])
bode(frq, repf [,comments])
PARAMETERS :
- sl
: syslin list (SISO or SIMO linear system) in continuous or
discrete time.
- fmin,fmax
: real (frequency bounds (in Hz))
- step
: real (logarithmic step.)
- comments
: vector of character strings (captions).
- frq
: row vector or matrix (frequencies (in Hz) )
(one row for each SISO subsystem).
- db
: row vector or matrix ( magnitudes (in Db)).
(one row for each SISO subsystem).
- phi
: row vector or matrix ( phases (in degree))
(one row for each SISO subsystem).
- repf
: row vector or matrix of complex numbers (complex frequency response).
DESCRIPTION :
Bode plot, i.e magnitude and phase of the frequency response of sl.
sl can be a continuous-time or discrete-time SIMO system (see syslin).
In case of multi-output the outputs are plotted with different
symbols.
The frequencies are given by the bounds fmin,fmax (in Hz) or by a row-vector
(or a matrix for multi-output) frq.
step is the ( logarithmic ) discretization step. (see calfrq for the
choice of default value).
comments is a vector of character strings (captions).
db,phi are the matrices of modulus (in Db) and phases (in degrees).
(One row for each response).
repf matrix of complex numbers. One row for each response.
Default values for fmin and fmax are
1.d-3, 1.d+3 if sl is continuous-time
or 1.d-3, 0.5 if sl is discrete-time.
Automatic discretization of frequencies is made by calfrq.
EXAMPLE :
s=poly(0,'s')
h=syslin('c',(s^2+2*0.9*10*s+100)/(s^2+2*0.3*10.1*s+102.01))
title='(s^2+2*0.9*10*s+100)/(s^2+2*0.3*10.1*s+102.01)';
bode(h,0.01,100,title);
h1=h*syslin('c',(s^2+2*0.1*15.1*s+228.01)/(s^2+2*0.9*15*s+225))
xbasc()
bode([h1;h],0.01,100,['h1';'h'])
See Also :
black
X, nyquist
X, gainplot
X, repfreq
X, g_margin
X, p_margin
X, calfrq
X, phasemag
X
2.8 champ draw a 2d vector field
CALLING SEQUENCE :
champ(x,y,fx,fy [,arfact,rect,strf])
champ1(x,y,fx,fy [,arfact,rect,strf])
PARAMETERS :
- x,y
: two vectors which define the grid.
- fx
: a matrix which describes the x component of the vector field. fx(i,j) is the x component of the vector field at point (x(i),y(j)).
- fy
: a matrix which describes the y component of the vector field. fy(i,j) is the y component of the vector field at point (x(i),y(j)).
- arfact
: an optional argument of type real which gives a scale factor for the display of the arrow heads on the plot (default value is 1.0)
- rect
: a vector rect=[xmin,ymin,xmax,ymax] which gives the boundaries of the
graphic frame to use.
- strf
: is a string of length 3 "xyz" which has the same meaning as the strf
parameter of plot2d. The parameter "x" has no effect with champ.
DESCRIPTION :
champ draws a 2d vector field. If ones uses champ the length
of the arrows are proportional to the field intensity and if
one uses champ1 (with a color screen) the color of the
arrow depends on the intensity of the field.
Enter the command champ() to see a demo.
EXAMPLE :
// using rect has graphic boundaries
champ(-5:5,-5:5,rand(11,11),rand(11,11),1,[-10,-10,10,10],"011");
xgrid();
xbasc();
// using (x,y) to get boundaries
champ(-5:5,-5:5,rand(11,11),rand(11,11),2,[-10,-10,10,10],"021");
// using coloured arrows
xset("use color",1)
champ1(-5:5,-5:5,rand(11,11),rand(11,11),2,[-10,-10,10,10],"021");
Author :
J.Ph.C.
2.9 champ1 draw a 2d vector field
CALLING SEQUENCE :
champ1(x,y,fx,fy [,arfact,rect,strf])
DESCRIPTION :
see champ
2.10 chart Nichols chart
CALLING SEQUENCE :
chart([flags])
chart(gain [,flags])
chart(gain,phase [,flags])
PARAMETERS :
- gain
: real vector ( gains (in DB))
- phase
: real vector (phases (in degree))
- flags
: a list of at most 4 flags list(sup [,leg [,cm [,cphi]]])
1
- sup
: 1 indicates superposition on the previous plot
0 no superposition is done
- leg
: 1 indicates that legends are drawn, o: no legends
- cm
: color number (see plot2d) for gain curves
- cphi
: color number (see plot2d) for phase curves
0
DESCRIPTION :
plot the Nichols'chart.
The default values for gain and phase are respectively :
[-12 -8 -6 -5 -4 -3 -2 -1.4 -1 -.5 0.25 0.5 0.7 1 1.4 2 2.3 3 4 5 6 8 12]
[-(1:10) , -(20:10:160)]
EXAMPLE :
s=poly(0,'s')
h=syslin('c',(s^2+2*0.9*10*s+100)/(s^2+2*0.3*10.1*s+102.01))
black(h,0.01,100,'(s^2+2*0.9*10*s+100)/(s^2+2*0.3*10.1*s+102.01)')
chart(list(1,0,2,3));
Another example :
xbasc()
h1=h*syslin('c',(s^2+2*0.1*15.1*s+228.01)/(s^2+2*0.9*15*s+225))
black([h1;h],0.01,100,['h1';'h'])
chart([-8 -6 -4],[80 120],list(1,0));
2.11 colormap Using colors in Scilab
DESCRIPTION :
Colormaps.
EXAMPLE :
m=228;
n = fix(3/8*m);
r = [(1:n)'/n; ones(m-n,1)];
g = [zeros(n,1); (1:n)'/n; ones(m-2*n,1)];
b = [zeros(2*n,1); (1:m-2*n)'/(m-2*n)];
h = [r g b];
xset('colormap',h);
plot3d1()
See Also :
xget
X, xset
X
2.12 contour level curves of surface
CALLING SEQUENCE :
contour(x,y,z,nz,[theta,alpha,caption,flag,bbox,zlev])
contour2d(x,y,z,nz,[style,strf,leg,rect,nax])
PARAMETERS :
- x,y
: two real vectors of size respectively (1,n1) and (1,n2).
- z
: real matrix of size (n1,n2) (values)
- nz
: real vector of size > 1 (the level values) or an integer ( the
number of level curves ).
- flag
: is a real vector of size three [mode,type,box]
- zlev
: real number
- [theta,alpha,caption,flag,bbox,zlev]
: see plot3d
- [style,strf,leg,rect,nax]
: (see plot2d). The argument style gives the dash styles or colors
which are to be used for level curves. It must have the same size as the requested level
curves. The other arguments follows the rules given in plot2d.
DESCRIPTION :
Draws level curves of a surface z=f(x,y). The level curves can be
drawn on a 3D surface or on 2D plot. For level curves on a 2d plot, the function
contour2d should be preferred to the function contour since
it accepts standard 2d parameters [style,strf,leg,rect,nax].
for level curves on a 3d plot, the optional arguments are the same as for the function
plot3d (except zlev ) and their meaning are the same. They control the
drawing of level curves on a 3D plot.
Only flag(1)=mode has a special meaning.
1
- mode=0
: the level curves are drawn on the surface defined by (x,y,z)
- mode=1
: the level curves are drawn on a 3D plot and on the plan defined by
equation z=zlev
- mode=2
: The level curves are drawn on a 2D plot.
0
Enter the command contour() to see a demo.
EXAMPLE :
contour2d(1:10,1:10,rand(10,10),5,1:5,"011"," ",[0,0,11,11]);
See Also :
fcontour
X, fcontour2d
X
Author :
J.Ph.C..
2.13 contour2d level curves of surface on a 2D graphics
CALLING SEQUENCE :
contour2d(x,y,z,nz,[style,strf,leg,rect,nax])
DESCRIPTION :
see contour
EXAMPLE :
contour2d(1:10,1:10,rand(10,10),5,1:5,"011"," ",[0,0,11,11]);
2.14 driver select a driver for plotting
CALLING SEQUENCE :
driver(driver_name)
current_driver=driver()
PARAMETERS :
- driver_name
: string (driver to be selected).
DESCRIPTION :
This function is used to select a graphic driver, or with no arguments to get the current driver name.
Most of the time, a user can ignore this function and change its driver
by calling high level functions such as xbasc or xbasimp.
The selected driver can be one of the following :
- "X11"
: an X Window driver.
- "Pos"
: a Postscript driver.
- "Rec"
: an X Window driver (X11) which also records all the graphic
commands. this is the default driver.
- "Fig"
: an XFig driver. (Clipping of objects is not provided in XFig).
See Also :
xtape
X, xbasc
X, xbasimp
X
Author :
J.Ph.C.
2.15 edit_curv interactive graphic curve editor
CALLING SEQUENCE :
[x,y,ok,gc] = edit_curv(y)
[x,y,ok,gc] = edit_curv(x,y)
[x,y,ok,gc] = edit_curv(x,y,job)
[x,y,ok,gc] = edit_curv(x,y,job,tit)
[x,y,ok,gc] = edit_curv(x,y,job,tit,gc)
PARAMETERS :
- x
: vector of x coordinates
- y
: vector of y coordinates
- job
: a character string formed by one to three of the characters 'a','x','y'
1
- 'a' : to add points to the edited curve
- 'x' : to modify x coordinates of the edited curve points
- 'y' : to modify y coordinates of the edited curve points
0
- tit
: a vector of three character strings which give the curve legend
- gc
: a list of graphic window parameters: gc=list(rect,nax)
1
- rect : bounds of the graphics (see plot2d for details)
- nax : graduation parameters (see plot2d for details)
0
- ok
: indicator if ok==%t user as returned with 'ok' menu else user as returned with 'abort' menu
: list (graphical objects created under edit_curv
DESCRIPTION :
edit_curv is an interactive graphic curve editor. To add a new point
simply click at the desired location, the added point will be
connected to the nearest end-point. to move a point click on it, drag
the mouse to the new position and click to fix the new position
Author :
Serge Steer
2.16 errbar add error tic on a graphic
CALLING SEQUENCE :
errbar(x,y,em,ep)
PARAMETERS :
- x,y,em,ep
: four matrices of the same size.
DESCRIPTION :
Used to add vertical error bars on a 2D plot.
x and y have the same meaning as in plot2d;
em(i,j) and ep(i,j) stands for the error interval on the value y(i,j)
[y(i,j)-em(i,j),y(i,j)+ep(i,j)]
Enter the command errbar() to see a demo.
EXAMPLE :
x=0:0.1:2*%pi;
y=[sin(x);cos(x)]';x=[x;x]';plot2d(x,y);
errbar(x,y,0.05*ones(x),0.03*ones(x));
Author :
J.Ph.C..
2.17 eval3d values of a function on a grid
CALLING SEQUENCE :
[z]=eval3d(fun,x,[y])
PARAMETERS :
- fun
: function accepting vectors as arguments.
- x,y
: 2 vectors of size (1,n1) and (1,n2). (default value for y : y=x).
- z
: matrix of size (n1,n2).
DESCRIPTION :
This function returns a matrix z(n1,n2). z(i,j)=fun(x(i),y(j)).
If the function fun doesn't accept arguments of type vector use the
primitive feval.
EXAMPLE :
x=-5:5;y=x;
deff('[z]=f(x,y)',['z= x.*y']);
z=eval3d(f,x,y);
plot3d(x,y,z);
//
deff('[z]=f(x,y)',['z= x*y']);
z=feval(x,y,f);
plot3d(x,y,z);
See Also :
feval
X
Author :
Steer S.
2.18 eval3dp computes facets of a 3D parametrized surface
CALLING SEQUENCE :
[x,y,z]=eval3dp(fun,p1,p2)
PARAMETERS :
- fun
: a Scilab function.
- p1
: a vector of size n
- p2
: a vector of size m
- x,y,z
: return value.Four 4x(n-1*m-1) matrices.
DESCRIPTION :
Computes a set of facets which describe a 3D surface. The facet number
k is a four sided polygon stored in x(:,k),y(:,k),z(:,k).
The function fun(p1,p2) computes the (x,y,z) coordinates
of the corresponding point on the surface, But for efficiency the
function fun is supposed to work with two vector arguments.
EXAMPLE :
p1=linspace(0,2*%pi,10);
p2=linspace(0,2*%pi,10);
deff('[x,y,z]=scp(p1,p2)',['x=p1.*sin(p1).*cos(p2)';
'y=p1.*cos(p1).*cos(p2)';
'z=p1.*sin(p2)'])
[x,y,z]=eval3dp(scp,p1,p2);
plot3d(x,y,z)
See Also :
eval3d
X, plot3d
X, feval
X, genfac3d
X
2.19 evans Evans root locus
CALLING SEQUENCE :
evans(H [,kmax])
PARAMETERS :
- H
: list (linear system syslin )
- kmax
: real (maximum gain desired for the plot )
DESCRIPTION :
Gives the Evans root locus for a linear system in state-space or
transfer form H(s) (syslin list). This is the locus of the roots of
1+k*H(s)=1+k*N(s)/D(s), in the complex plane. For a selected
sample of gains k <= kmax, the imaginary part of the roots of
D(s)+k*N(s) is plotted vs the real part.
To obtain the gain at a given point of the locus you can
simply execute the following instruction :
k=-1/real(horner(h,[1,%i]*locate(1))) and click the desired point
on the root locus. If the coordinates of the selected point are
in the real 2 x 1 vector P=locate(1) this k solves the equation k*N(w) + D(w) =0 with w=P(1)+%i*P(2)=[1,%i]*P.
EXAMPLE :
H=syslin('c',352*poly(-5,'s')/poly([0,0,2000,200,25,1],'s','c'));
evans(H,100)
P=3.0548543 - 8.8491842*%i; //P=selected point
k=-1/real(horner(H,P));
Ns=H('num');Ds=H('den');
roots(Ds+k*Ns) //contains P as particular root
// Another one
xbasc();s=poly(0,'s');n=1+s;
d=real(poly([-1 -2 -%i %i],'s'));
evans(n,d,100);
//
xbasc();n=real(poly([0.1-%i 0.1+%i,-10],'s'));
evans(n,d,80);
See Also :
kpure
X, krac2
X, locate
X
2.20 fac3d complex 3D surface plotting
CALLING SEQUENCE :
fac3d(x,y,z[,theta,alpha,leg,flag,ebox])
fac3d1(x,y,z[,theta,alpha,leg,flag,ebox])
PARAMETERS :
- x,y,z
: matrices of sizes (nf,n1) (facets coordinates). nf :facets size, n1:
number of facets
- rest
: see plot3d.
DESCRIPTION :
Draw the surface defined by a set of n1 facets of coordinates
x(:,i), y(:,i), z(:,i) i=1:n1.
In fact this function is nothing but plot3d.
Enter the command fac3d() to see a demo.
See Also :
plot3d
X, eval3dp
X, genfac3d
X
2.21 fchamp draw a 2d vector field
CALLING SEQUENCE :
fchamp(f,t,xr,yr,[arfact,brect,strf])
PARAMETERS :
- f
: a function which describes the vector field.
1
- -
It can be a function name f,
where f is supposed to be a function of type [y]=f(t,x,[u]) ( f returns
a column vector of dimension 2, y, which gives the value of the vector field
f at point x and time t.
- -
It can also be an object of type list,
list(f1,u1) where f1 is a function (f [y]=f1(t,x,u) ) and u1 gives the value of the parameter u.
0
- t
: The selected time.
- xr,yr
: two vectors of size (1,n1) (1,n2) which specifies the grid on which the vector field is to be computed.
- arfact,brect,strf
: optional arguments, see champ.
DESCRIPTION :
the fchamp is used to draw a two dimensional vector field described by a a Scilab
external.
Enter the command champ() to see a demo.
EXAMPLE :
deff('[xdot] = derpol(t,x)',['xd1 = x(2)';
"xd2 = -x(1) + (1 - x(1)**2)*x(2)";
"xdot = [ xd1 ; xd2 ]"]);
xf= -1:0.1:1;
yf= -1:0.1:1;
fchamp(derpol,0,xf,yf);
xbasc();
fchamp(derpol,0,xf,yf,1,[-2,-2,2,2],"011");
Author :
J.Ph.C.
2.22 fcontour level curves
CALLING SEQUENCE :
fcontour(xr,yr,f,nz,[theta,alpha,caption,flag,bbox,zlev])
fcontour2d(x,y,z,nz,[style,strf,leg,rect,nax])
PARAMETERS :
- xr,yr
: two real vectors of size respectively (1,n1) and (1,n2).
- f
: is an external which gives the analytic expression of the surface.
z=f(x,y) is first computed on the grid specified by xr.yr. Then, control is
passed to the routine contour.
- nz
: specifies the level values or number.
1
- -
If nz is of size 1, its value considered as
an integer gives the number of level curves equally spaced from zmin to zmax.
- -
If nz is a vector, nz(j) gives the value of the jth level curve.
0
- [rest]
: for theta,alpha,caption, bbox see plot3d
- flag
: real vector of size 3 ; flag=[mode,type,box]; flag(2) and flag(3) are
the same as in plot3d; flag(1) has the following meaning :
1
- flag(1)=0
: the level curves are drawn on the surface defined by (x,y,z)
- flag(1)=1
: the level curves are drawn on a 3D plot and on the plan defined by
equation z=zlev
- flag(1)=2
: The level curves are drawn on a 2D plot.
0
DESCRIPTION :
Draws the level curves of a surface z=f(x,y). The level curves can be
drawn on a 3D surface or on 2D plot. For level curves on a 2d plot, the function
fcontour2d should be preferred to the function fcontour since
it accepts standard 2d parameters [style,strf,leg,rect,nax].
fcontour and fcontour2d call respectively contour and contour2d Enter the command fcontour() or fcontour2d to see a demo.
See Also :
contour
X, contour2d
X
Author :
J.Ph.C..
2.23 fcontour2d level curves of surface on a 2D graphics
CALLING SEQUENCE :
fcontour2d(x,y,z,nz,[style,strf,leg,rect,nax])
DESCRIPTION :
see fcontour
2.24 fec contour level of a function defined on a triangular mesh
CALLING SEQUENCE :
fec(x,y,triangles,func,no,Ntr,strflag,legend,brect,aaint)
PARAMETERS :
- x,y
: two vectors of size no, (x(i),y(i)) gives the coordinates of node
i
- func
: a vector of size no : func(i) gives the value of the function for which we want the level curves.
- triangles
: is a [Ntr,5] matrix. Each line of triangles specifies a triangle of the
mesh triangle(j) = [number,node1,node2,node3,flag].
node1,node2,node3 are the number of the nodes which constitutes the triangle. number is the number of the triangle and flag is an integer not used in the fec function
- rest
: for the remaining arguments strflag,legend,brect,aint, see plot2d
DESCRIPTION :
See the demo files demos/fec.
fec.ex1 is a simple demo file in which a mesh and a function
on that mesh is completely built in Scilab syntax
fec.ex2 is an example for which the mesh and the function value where
computed by an external mesh builder (amdba type mesh) and an external program.
A set of macros ( provided in file macros.sci) can be used to read the
data files in Scilab and plot the results.
See Also :
Sfgrayplot
X, Sgrayplot
X
2.25 fgrayplot 2D plot with gray levels
CALLING SEQUENCE :
fgrayplot(x,y,f,[strf,rect,nax])
PARAMETERS :
- x,y
: real vectors of size respectively (1,n1) and (1,n2).
- f
: an external (analytic expression of the surface)
- strf,rect,nax
: optional arguments, ( see plot2d)
DESCRIPTION :
2D plot of a surface using gray levels; f gives the analytic expression
of the surface. z=f(x,y) is first computed on the grid specified by
xr.yr then control is passed to the routine grayplot.
Enter the Scilab command fgrayplot() to see a demo.
EXAMPLE :
deff('[z]=surf(x,y)','z=x**2+y**2');
fgrayplot(-1:0.1:1,-1:0.1:1,surf,"111",[-2,-2,2,2]);
See Also :
Sgrayplot
X,Sfgrayplot
X,grayplot
X
Author :
J.Ph.C..
2.26 fplot2d 2D plot of a curve defined by an external
CALLING SEQUENCE :
fplot2d(xr,f,[style,strf,leg,rect,nax])
PARAMETERS :
- xr
: vector of size (n1,1).
- f
: external (of type [y]=f(x))
- [rest]
: see plot2d
DESCRIPTION :
The curve is approximated by a piecewise linear interpolation using the points
(xr(i),f(xr(i)).
Enter the command fplot2d() to see a demo.
EXAMPLE :
deff("[y]=f(x)","y=sin(x)+cos(x)");
fplot2d((0:0.1:10)*%pi/10,f);
fplot2d((0:0.1:10)*%pi/10,f,5);
Author :
J.Ph.C..
2.27 fplot3d 3D plot of a surface defined by an external
CALLING SEQUENCE :
fplot3d(xr,yr,f,[theta,alpha,leg,flag,ebox])
PARAMETERS :
- xr
: matrix of size (1,n1)
- yr
: matrix of size (1,n2).
- f
: external (z=f(x,y))
- theta, alpha
: real (spherical coordinates in degrees of the observation point)
- leg
: string (caption for each axis. @ is a field separator
e.g. "X@Y@Z")
- flag
: real vector of size three flag=[mode,type,box]
1
- mode
: integer (treatment of hidden parts)
2
- mode >=2
the hidden parts of the surface are removed and the surface is painted
in gray (from low gray to black according to the value of mode)
- mode = 1
The hidden parts of the surface are drawn
- mode <= 0
Only the shadow of the surface is painted with a gray level depending
on mode
1
- type
: Scaling
2
- if type = 0
the plot is made using the current 3D scaling ( set by a previous call to
param3d, plot3d, contour, plot3d1
- if type = 1,
the value of ebox=[xmin,xmax,ymin,ymax,zmin,zmax] specifies
the boundaries
- else
the boundaries are computed with the given datas.
1
- box
: frame display around the plot.
2
- box=0
: Nothing is drawn around the plot
- box=1
:not implemented
- box=2
: only the axes behind the surface are drawn
- box=3
: a box surrounding the surface is drawn and captions are added
1
0
DESCRIPTION :
This routines plots a surface defined by an external f.
the values of f on the grid defined by xr.yr are first computed
using feval, then control is passed to the primitive plot3d.
Enter the command fplot3d() to see a demo.
Author :
J.Ph.C.
2.28 fplot3d1 gray level plotting of a surface
CALLING SEQUENCE :
fplot3d1(xr,yr,f [,theta,alpha,leg,flag,ebox])
PARAMETERS :
( )
: see fplot3d
DESCRIPTION :
This routines plots a surface defined by an external f.
the value of f on the grid defined by xr.yr is first computed
using feval, then control is passed to the primitive plot3d1.
Enter the command fplot3d1() to see a demo.
Author :
J.Ph.C.
2.29 gainplot magnitude plot
CALLING SEQUENCE :
gainplot(sl,fmin,fmax [,step] [,comments] )
gainplot(frq,db,phi [,comments])
gainplot(frq, repf [,comments])
PARAMETERS :
- sl
: list (syslin SIMO linear system).
- fmin,fmax
: real scalars (frequency interval).
- step
: real (discretization step (logarithmic scale))
- comments
: string
- frq
: matrix (row by row frequencies)
- db,phi
: matrices (magnitudes and phases corresponding to frq)
- repf
: complex matrix. One row for each frequency response.
DESCRIPTION :
Same as Bode but plots only the magnitude.
EXAMPLE :
s=poly(0,'s')
h=syslin('c',(s^2+2*0.9*10*s+100)/(s^2+2*0.3*10.1*s+102.01))
gainplot(h,0.01,100,'(s^2+2*0.9*10*s+100)/(s^2+2*0.3*10.1*s+102.01)')
xbasc()
h1=h*syslin('c',(s^2+2*0.1*15.1*s+228.01)/(s^2+2*0.9*15*s+225))
gainplot([h1;h],0.01,100,['h1';'h'])
See Also :
bode
X, black
X, nyquist
X, freq
X, repfreq
X, g_margin
X, p_margin
X
2.30 genfac3d convert 3d datas to four sided facets
CALLING SEQUENCE :
[xx,yy,zz]=genfac3d(x,y,zmat [,mask])
PARAMETERS :
- zmat
: a (mxn) matrix.
- x
:x axis coordinates vector ( size m )
- y
:y axis coordinates vector ( size n )
- mask
: boolean optional matrix with same size as zmat used to select
entries of zmat to be represented by facets.
- xx,yy,zz
: Three 4x(n-1xm-1) matrices. xx(:,i),yy(:,i),zz(:,i) are respectively the
x-axis,y-axis and z-axis coordinates of the ith facet
DESCRIPTION :
Converts 3d data ( two vectors x,y and a matrix z which
code the surface z(i,j)=f(x(i),y(j)) ) to a four sided facets representation.
EXAMPLE :
t = linspace(0,2*%pi,10);
zmat=sin(t')*cos(t);
plot3d(t,t,zmat)
[xx,yy,zz]=genfac3d(t,t,zmat);
plot3d(xx,yy,zz)
plot3d([xx xx],[yy yy],[zz 4+zz])
See Also :
plot3d
X, eval3dp
X
2.31 geom3d projection from 3D on 2D
CALLING SEQUENCE :
[x,y]=geom3d(x1,y1,z1)
PARAMETERS :
- x1,y1,z1
: real matrices of the same size (points in R3)
- x,y
: real matrices of the same size as x1,y1 or z1
DESCRIPTION :
After having used a 3d plotting function as plot3d, plot3d1 and param3d, this function gives the correspondence
between a point in R3 space (x1(i),y1(i),z1(i)) and the corresponding point in the projected graphic plan (x(i),y(j)).
all the graphical primitives working on (x,y) can then be used
for superposition on a plot3d
EXAMPLE :
deff("[z]=surf(x,y)","z=sin(x)*cos(y)");
t=%pi*(-10:10)/10;
fplot3d(t,t,surf,35,45,"X@Y@Z");
//Gives a plot3d
//now (t,t,sin(t).*cos(t) ) is a curve on the surface
//which can be drawn using param3d or the following code
[x,y]=geom3d(t,t,sin(t).*cos(t));
xpoly(x,y,"lines")
//adding a comment
[x,y]=geom3d([0,0],[0,0],[5,0]);
xsegs(x,y);
xstring(x(1),y(1)," The point (0,0,0)");
Author :
J.Ph.C.
2.32 getcolor dialog to select color(s) in the current colormap
CALLING SEQUENCE :
c=getcolor(title [,cini])
c=getcolor()
PARAMETERS :
- title
: string, dialog title
- cini
: vector of initial color indexes. Default value is xget('pattern')
- c
: Vector of selected color indexes, or [] if user has clicked on "Cancel" button
DESCRIPTION :
getcolor opens a dialog choice box with as many palettes as cini vector size. Palettes depends on the current colormap.
See Also :
xset
X, xsetm
X
2.33 getsymbol dialog to select a symbol an its size
CALLING SEQUENCE :
c=getsymbol(title)
PARAMETERS :
- title
: string, dialog title
- c
: Vector with 2 entries [n,sz].
DESCRIPTION :
getsymbol opens a dialog choice box where user may select a
symbol type n and size sz .
See Also :
xset
X, xsetm
X
2.34 gr_menu simple interactive graphic editor
CALLING SEQUENCE :
[sd1]=gr_menu([sd,flag,no_frame])
PARAMETERS :
- sd
: list (output of gr_menu), or vector of
length four [xmin,ymin,xmax,ymax] (boundaries of the plot).
- sd1
: list (graphical objects created under gr_menu
- flag,noframe
: integers with 0, 1 value. Use flag=1 for non interactive mode
(i.e to redraw saved gr_menu graphics) and no_frame=1 to
avoid a frame around gr_menu graphics.
DESCRIPTION :
gr_menu is a simple interactive graphic editor.
When you execute gr_menu(), three new menus, Objects,
Settings and Edit are added to the current graphics window.
Use the item Exit of menu Edit to exit gr_menu.
The created graphics are saved as a list which
can be given to gr_menu as an entry value.
- [sd]=gr_menu([xmin,ymin,xmax,ymax])
: enters gr_menu with a fixed frame
- [sd]=gr_menu();
: enters gr_menu with the fixed frame [0 0 100 100].
- [sd]=gr_menu(sd)
: redraws the graphics stored in sd and enters interactive mode
- [sd]=gr_menu(sd,1)
: only draws the graphics stored in sd.
- [sd]=gr_menu(sd,1,1)
: only draws the graphics stored in sd and no frame is added.
Author :
S.S. & J.Ph.C.
2.35 graduate pretty axis graduations
CALLING SEQUENCE :
[xi,xa,np]=graduate( xmi, xma,n1,n2)
[xi,xa,np]=graduate( xmi, xma)
PARAMETERS :
- xmi,xma
: real scalars
- n1, n2
: integers with default values 3,10
- xi, xa
:real scalars
- np
: integer
DESCRIPTION :
graduate looks for the minimum interval [xi,xa] and a number of tics
np such that:
xi <= xmi <= xma <= xa
xa - xi / np = k(10^n),k in [1 3 5] for an integer n
n1 < np < n2
EXAMPLE :
y=(0:0.33:145.78)';
xbasc();plot2d1('enn',0,y)
[ymn,ymx,np]=graduate(mini(y),maxi(y))
rect=[1,ymn,prod(size(y)),ymx];
xbasc();plot2d1('enn',0,y,1,'011',' ',rect,[10,3,10,np])
See Also :
xsetech
X,plot2d
X
Author :
S. Steer 1992
2.36 graycolormap Linear gray colormap
CALLING SEQUENCE :
cmap=graycolormap(n)
PARAMETERS :
- n
: an integer greater or equal than 1, the "colormap" size
- cmap
: matrix with 3 column, [R,G,B] color definition
DESCRIPTION :
Computes a colormap with grays colors varying linearly
See Also :
colormap
X, xset
X, plot3d1
X, hotcolormap
X
EXAMPLE :
xset('colormap',graycolormap(32))
plot3d1()
2.37 grayplot 2D plot of a surface using colors
CALLING SEQUENCE :
grayplot(x,y,z,[strf,rect,nax])
PARAMETERS :
- x,y
: real vectors of size respectively (1,n1) and (1,n2).
- z
: real matrix of size (n1,n2) (values of f)
- strf,rect,nax
: optional arguments, ( see plot2d)
DESCRIPTION :
The surface is given by values z(i,j)=f(x(i),y(j)) on a grid defined by x,y.
Each rectangle on the grid is filled with a gray level depending
on the average value of f on the corners of the rectangle.
Enter the command grayplot() to see a demo.
EXAMPLE :
x=-10:10;y=-10:10;m=rand(21,21);
grayplot(x,y,m,"111",[-20,-20,20,20]);
See Also :
Sgrayplot
X, Sfgrayplot
X, fgrayplot
X
Author :
J.Ph.C..
2.38 hist3d 3D representation of an histogram
CALLING SEQUENCE :
hist3d(f [,theta,alpha,leg,flag,ebox])
PARAMETERS :
- f
: matrix or list :
1
- -
matrix f(i,j)= F(x(i),y(j)), x and y taken as
0:m and 0:n, ( (m,n) is the size of f).
- -
list of size 3; list(f,x,y) where f is a matrix of size (m,n)
and x and y two vectors of size (1,n+1) and (1,m+1)
0
- rest
: see plot3d
DESCRIPTION :
3 dimensional representation of an 2d histogram :
the values associated to the intervals ([x(i) x(i+1)[ X [y(i) y(i+1)[) Enter the command hist3d() to see a demo.
See Also :
plot3d
X
Author :
Steer S. & JPhilippe C.
2.39 histplot plot an histogram
CALLING SEQUENCE :
histplot(npoint,data,[style,strf,leg,rect,nax])
PARAMETERS :
- npoint
: integer or a vector of increasing values of size (1,n1)
- data
: real vector
- [rest ]
: see plot2d
DESCRIPTION :
- -
if npoint is an integer, plots an histogram of the values stored in data using npoint-equally spaced classes.
- -
if npoint is a vector plots an histogram of the values stored in data using the classes ]xi(k) xi(k+1)].
Enter the command histplot() to see a demo.
2.40 hotcolormap Yellow to red RGB colormap
CALLING SEQUENCE :
cmap=hotcolormap(n)
PARAMETERS :
- n
: an integer greater or equal than 3, the "colormap" size
- cmap
: matrix with 3 column, [R,G,B] color definition
DESCRIPTION :
Computes a colormap with hots colors varying from red to yellow
See Also :
colormap
X, xset
X, plot3d1
X, graycolormap
X
EXAMPLE :
xset('colormap',hotcolormap(32))
plot3d1()
2.41 isoview set scales for isometric plot
CALLING SEQUENCE :
isoview(xmin,xmax,ymin,ymax)
PARAMETERS :
- xmin,xmax,ymin,ymax
: four real values
DESCRIPTION :
isoview(xmin,xmax,ymin,ymax) is used to set the graphic scales in order
to have isometric scales on the X and Y axes. The requested values
xmin, xmax, ymin, ymax must be contained in the computed frame of
the graphic window. This function sets the current graphic scales
and can be used in conjunction with graphic routines which request
the current graphic scale ( strf="x0y" in plot2d ). This function
does not modify the size of the graphic window.
EXAMPLE :
xbasc();
t=(0:0.1:2*%pi)';
isoview(-1,1,-1,1);
plot2d(sin(t),cos(t),1,'001')
See Also :
square
X
Author :
Steer S.
2.42 locate mouse selection of a set of points
CALLING SEQUENCE :
[x]=locate([n,flag])
PARAMETERS :
- n, flag
: two integer values
- x
: vector (2,n1) ( n1=n if the parameter n is given)
DESCRIPTION :
This function is used to get the coordinates of one or more
points selected with the mouse on a graphic window. The coordinates
are given using the current graphic scale.
- x=locate(n)
: if n>0, n points are selected and their coordinates are returned in
x(2,n)
- x=locate(n)
: If n<=0 points are selected until the user click with the left button
which stands for stop. The last point ( clicked with the left button) is
not returned.
- x=locate()
: same as x=locate(-1)
If flag = 1 a cross is drawn at location point each time the mouse is clicked.
See Also :
xclick
X
Author :
S.S. & J.Ph.C
2.43 m_circle M-circle plot
CALLING SEQUENCE :
m_circle()
m_circle(gain)
PARAMETERS :
- gain
: vector of gains (in DB). The default value is
1
- gain
=[-12 -8 -6 -5 -4 -3 -2 -1.4 -1 -.5 0.25 0.5 0.7 1 1.4 2 2.3 3 4 5 6 8 12]
0
DESCRIPTION :
m_circle is used with nyquist.
EXAMPLE :
//Example 1 :
s=poly(0,'s')
h=syslin('c',(s^2+2*0.9*10*s+100)/(s^2+2*0.3*10.1*s+102.01))
nyquist(h,0.01,100,'(s^2+2*0.9*10*s+100)/(s^2+2*0.3*10.1*s+102.01)')
m_circle();
//Example 2:
xbasc();
h1=h*syslin('c',(s^2+2*0.1*15.1*s+228.01)/(s^2+2*0.9*15*s+225))
nyquist([h1;h],0.01,100,['h1';'h'])
m_circle([-8 -6 -4]);
See Also :
nyquist
X, chart
X, black
X
Author :
S.Steer.
2.44 milk_drop test for plot3d
CALLING SEQUENCE :
[z]=milk_drop(x,y)
PARAMETERS :
- x,y
: two vectors of size (1,n1) and (1,n2)
- z
: matrix of size (n1,n2)
DESCRIPTION :
milk_drop is a function [z]=milk_drop(x,y) which can be used to test the function eval3d
Author :
Steer S.
2.45 nyquist nyquist plot
CALLING SEQUENCE :
nyquist( sl,[fmin,fmax] [,step] [,comments] )
nyquist( sl, frq [,comments] )
nyquist(frq,db,phi [,comments])
nyquist(frq, repf [,comments])
PARAMETERS :
- sl
: syslin list (SIMO linear system in continuous or discrete time )
- fmin,fmax
: real scalars (frequency bounds (in Hz))
- step
: real (logarithmic discretization step)
- comments
: string vector (captions).
- frq
: vector or matrix of frequencies (in Hz) (one row for
each output of sl).
- db,phi
: real matrices of modulus (in Db) and phases (in degree) (one row for each output of sl).
- repf
: matrix of complex numbers. Frequency response (one row
for aech output of sl)
DESCRIPTION :
Nyquist plot i.e Imaginary part versus Real part of the frequency
response of sl.
For continous time systems sl(2*%i*%pi*w) is plotted.
For discrete time system or discretized systems sl(exp(2*%i*%pi*w*fd) is used ( fd=1 for discrete time systems and fd=sl('dt') for discretized systems )
sl can be a continuous-time or discrete-time SIMO system (see syslin).
In case of multi-output the outputs are plotted with different
symbols.
The frequencies are given by the bounds fmin,fmax (in Hz) or by a row-vector
(or a matrix for multi-output) frq.
step is the ( logarithmic ) discretization step. (see calfrq for the
choice of default value).
comments is a vector of character strings (captions).
db,phi are the matrices of modulus (in Db) and phases (in degrees).
(One row for each response).
repf is a matrix of complex numbers. One row for each response.
Default values for fmin and fmax are
1.d-3, 1.d+3 if sl is continuous-time
or 1.d-3, 0.5 if sl is discrete-time.
Automatic discretization of frequencies is made by calfrq.
EXAMPLE :
xbasc();
s=poly(0,'s');
h=syslin('c',(s^2+2*0.9*10*s+100)/(s^2+2*0.3*10.1*s+102.01));
comm='(s^2+2*0.9*10*s+100)/(s^2+2*0.3*10.1*s+102.01)';
nyquist(h,0.01,100,comm);
h1=h*syslin('c',(s^2+2*0.1*15.1*s+228.01)/(s^2+2*0.9*15*s+225))
xbasc();
nyquist([h1;h],0.01,100,['h1';'h'])
xbasc();nyquist([h1;h])
See Also :
bode
X, black
X, calfrq
X, freq
X, repfreq
X, phasemag
X
2.46 param3d set of points or parametric curves in 3-D
CALLING SEQUENCE :
param3d(x,y,z,[theta,alpha,leg,flag,ebox]
PARAMETERS :
- x,y,z
: three matrices of the same size (considered as vectors with
the Fortran storage convention) (points of the parametric curve)
- theta, alpha
: gives the coordinates in spherical angle of the observation point
- leg
: string describing the caption for each axis, the different fields
in the string are separated by the symbol @, for example : "X@Y@Z"
- flag =[type,box] :
where type and box have the same meaning as in plot3d
- ebox
: a vector of size (1,6) which gives the boundaries of the plot
[xmin,xmax,ymin,ymax,zmin,zmax] when the value of type is 1
DESCRIPTION :
param3d is used to obtain a graphic of a parametric curve in R3.
Enter the command param3d() to see a demo.
Look at param3d1 for multi R3 parametric curves and R3 point
drawing.
EXAMPLE :
t=0:0.1:5*%pi;
param3d(sin(t),cos(t),t/10,35,45,"X@Y@Z",[2,3])
xbasc();
xset("dashes",3)
param3d(rand(1,100),rand(1,100),rand(1,100),35,45,"X@Y@Z",[2,3])
See Also :
param3d1
X
Author :
J.Ph.C.
2.47 param3d1 set of points or parametric curves in 3-D
CALLING SEQUENCE :
param3d1(x,y,z,[theta,alpha,leg,flag,ebox]
param3d1(x,y,list(z,colors),[theta,alpha,leg,flag,ebox]
PARAMETERS :
- x,y,z
: three matrices of the same size [nl,nc]. Each column of the
matrix code one curve except when nl=1 and nc>0 in which case
It is assumed that there's only one curve. If colors is specified,
it must be a vector of size nc which gives for each curve
its color ( if color[i] >0 ) or the mark which is to be used
( if color[i] <= 0 ).
- theta, alpha
: gives the coordinates in spherical angle of the observation point
- leg
: string describing the caption for each axis, the different fields
in the string are separated by the symbol @, for example : "X@Y@Z"
- flag =[type,box] :
where type and box have the same meaning as in plot3d
- ebox
: a vector of size (1,6) which gives the boundaries of the plot
[xmin,xmax,ymin,ymax,zmin,zmax] when the value of type is 1
DESCRIPTION :
param3d1 is used to obtain a graphic of a parametric curve in R3,
and can also be used to see a set of points in R3
Enter the command param3d1() to see a demo.
EXAMPLE :
t=0:0.1:5*%pi; t=t';
param3d1([sin(t),sin(2*t)],[cos(t),cos(2*t)],...
list([t/10,sin(t)],[3,2]),35,45,"X@Y@Z",[2,3])
See Also :
param3d
X
Author :
J.Ph.C.
2.48 param3di parametric curves in 3-D with interactive view selection
CALLING SEQUENCE :
param3di(x,y,z,[theta,alpha,leg,flag,ebox]
PARAMETERS :
- x,y,z
: three matrices of the same size (considered as vectors with
the Fortran storage convention) (points of the parametric curve)
- theta, alpha
: gives the coordinates in spherical angle of the observation point
- leg
: string describing the caption for each axis, the different fields
in the string are separated by the symbol @, for example : "X@Y@Z"
- flag =[type,box] :
where type and box have the same meaning as in plot3d
- ebox
: a vector of size (1,6) which gives the boundaries of the plot
[xmin,xmax,ymin,ymax,zmin,zmax] when the value of type is
1
DESCRIPTION :
Draw the 3D curve f(x,y) and allow the user to change the view
with the mouse :
Pick a point within the graphic window (Left mouse button) and drag
the mouse (theta
increases for left to right move and alpha increases for down to up
move). When view is ok click with the left button to have the surface
drawn. click right button to exit.
For Pos and Fig drivers plot3di works just like plot3d
Enter the command param3di() to see a demo.
Author :
S Steer INRIA
2.49 plot simple plot
CALLING SEQUENCE :
plot(x,y,[xcap,ycap,caption])
plot(y,[xcap,ycap,caption])
PARAMETERS :
- x,y
: two vectors.
- caption, xcap, ycap
:
character strings or string matrices
DESCRIPTION :
plot y as function of x.
xcap and ycap are captions for x-axis
and y-axis respectively.
Invoked with one argument, plot(y) plots the y vector or,
if y is a matrix, its rows.
See Also :
plot2d
X
Author :
J.Ph.C..
2.50 plot2d multiple plot of functions
CALLING SEQUENCE :
plot2d(x,y,[style,strf,leg,rect,nax])
plot2d(y);
PARAMETERS :
- x,y
: two matrices of the same size [nl,nc]. nc gives the
number of curves and nl gives the number of points for each curve.
If nl=1, it's assumed that there's only one curve of nc points.
1
- nc
: is the number of curves
- nl
: is the number of points of each curve
for example : x=[ 1:10;1:10]',y= [ sin(1:10);cos(1:10)]'
0
- style
: is a real vector of size (1,nc). the style to use for curve j is
defined by size(j).
1
- -
if style[i] is negative the curve is plotted using the mark of Id style[i],
- -
if style[i] is strictly positive a dashed or plain line of id (or color)abs(style[i]) is used.
- -
When only one curve is drawn style can be of size (1,2) [style,pos] where style is used to specify the style and pos is an integer in the range
1,6 which specifies a position to use for the caption (this can be useful
when a user wants to draw multiple curves on a plot by calling the function plot
several times and wants to give a caption for each curve)
0
- strf
: is a string of length 3 "xyz"
1
- x
: captions are displayed if x is the character 1. Captions are given by the
string leg "leg1@leg2@...."
- y
: controls the computation of the frame
2
- y=0
: the current boundaries ( set by a previous call to an other high level
plotting function ) are used.
- y=1
: the argument rect is used to specify the boundaries of the plot.
rect=[xmin,ymin,xmax,ymax]
- y=2
: the boundaries of the plot are computed using max and min values of x and y.
- y=3
: like y=1 but produces isoview scaling
- y=4
: like y=2 but produces isoview scaling
- y=5
: like y=1 but the boundaries and nax can be changed to produce pretty graduations.
This mode is used when the zoom button is activated.
- y=6
: like y=2 but the boundaries and nax can be changed to produce pretty graduations.
This mode is used when the zoom button is activated.
1
- z
: controls the display of information on the frame around the plot
2
- z=1
: an axis is drawn the number of tics can be specified by the nax
argument. nax is a vector with four entries [nx,Nx,ny,Ny] where
nx (ny) is the number of subgrads on the x (y) axis and
Nx (Ny) is the number of graduations on the x (y) axis
- z=2
: the plot is only surrounded by a box
- other value
Nothing around the plot
1
0
DESCRIPTION :
plot2d simultaneously plot a set of 2D curves which are given by a set of points
using piecewise linear plotting
Enter the command plot2d() to see a demo.
EXAMPLE :
x=0:0.1:2*%pi;
//simple plot
plot2d(sin(x));
//multiple plot
xbasc();
plot2d([x;x;x]',[sin(x);sin(2*x);sin(3*x)]');
//multiple plot with captions
xbasc();
plot2d([x;x;x]',[sin(x);sin(2*x);sin(3*x)]',...
[1,2,3],"111","L1@L2@L3",[0,-2,2*%pi,2],[2,10,2,10]);
// isoview
xbasc();
plot2d(x',sin(x)',1,'041')
// auto scale
xbasc();
plot2d(x',sin(x)',1,'061')
See Also :
plot2d1
X, plot2d2
X, plot2d3
X, plot2d4
X
Author :
J.Ph.C..
2.51 plot2d1 multiple plot of functions
CALLING SEQUENCE :
plot2d1(str,x,y,[style,strf,leg,rect,nax])
PARAMETERS :
- str
: is a string of length three "abc"
1
- a
: can have the following values : e | o | g
2
- e
: means empty and specifies the fact that the value of x won't be used
( the x values are supposed to be regularly spaced) . The user must
anyway give a value to the x parameter when calling plot2d1, for example
plot2d1("enn",1,y).
- o
: stands for one. if there are many curves, they all
have the same x-values ( x is of size x(n,1) and y
of size y(n,n1). for example :
plot2d1("onn",(1:10)',[sin(1:10);cos(1:10)]')
- g
: stands for general. x and y must then have the same size
1
- b,c
: can have the values n or l.
2
- b=l
: a logarithmic axis is used on the X-axis
- c=l
: a logarithmic axis is used on the Y-axis
1
0
DESCRIPTION :
plot2d1 simultaneously plot a set of 2D curves.
Same as plot2d but with one more argument
str which enables logarithmic axis, and less specification for x.
Enter the command plot2d1() to see a demo.
See Also :
plot2d
X
Author :
J.Ph.C..
2.52 plot2d2 multiple plot of functions (step function)
CALLING SEQUENCE :
plot2d2(str,x,y,[style,strf,leg,rect,nax])
PARAMETERS :
[ ]
: see plot2d1 and plot2d for a description of parameters.
DESCRIPTION :
Same as plot2d1 but the functions given by the set of points (x,y) which are to be drawn are supposed to be piecewise constant.
Enter the command plot2d2() to see a demo.
EXAMPLE :
plot2d2("gnn",(1:4)',(1:4)',1,'111','step function',[0,0,5,5])
will plot a step function of value i on the segment (i,i+1).
the last segment is not drawn.
See Also :
plot2d
X, plot2d1
X, plot2d3
X
Author :
J.Ph.C..
2.53 plot2d3 multiple plot of functions (vertical bars)
CALLING SEQUENCE :
plot2d3(str,x,y,[style,strf,leg,rect,nax])
PARAMETERS :
see plot2d and plot2d1
DESCRIPTION :
Same as plot2d1 but curves are plotted using vertical bars.
Enter the command plot2d3() to see a demo.
See Also :
plot2d
X, plot2d1
X, plot2d2
X, plot2d4
X
Author :
J.Ph.C..
2.54 plot2d4 multiple plot of functions
CALLING SEQUENCE :
plot2d4(str,x,y,[style,strf,leg,rect,nax])
PARAMETERS :
see plot2d and plot2d1
DESCRIPTION :
Same as plot2d1 but curves are plotted using arrows
style. This can be useful when plotting solutions of ode in a phase
space.
Enter the command plot2d4() to see a demo.
See Also :
plot2d
X, plot2d1
X
Author :
J.Ph.C..
2.55 plot3d surface plotting
CALLING SEQUENCE :
plot3d(x,y,z [,theta,alpha,leg [,flag,ebox]])
plot3d(xf,yf,zf [,theta,alpha,leg [,flag,ebox]])
plot3d(xf,yf,list(zf,colors) [,theta,alpha,leg [,flag,ebox]])
PARAMETERS :
- x,y
: matrices of sizes (1,n1) and (1,n2) (point coordinates). These
coordinates must be monotone.
- z
: matrix of size (n1,n2) ( z(i,j) : value of f at the point
(x(i),y(j))
- xf,yf,zf
: (nf,n) matrices. xf(:,i),yf(:,i),zf(:,i) are respectively the
x-axis,y-axis and z-axis coordinates of the ith facet. Where nf is the size of the facets (nf must be greater than 2) and
n the number of facets. One can use list(zf,colors),
with colors a vector of size n in order to give specific
colors for each facet.
- theta, alpha
: real values giving in degree the spherical coordinates of
the observation point
- leg
: string (captions for each axis. this is string
with @ as a field separator, for example : "X@Y@Z")
- flag
: is a real vector of size three flag=[mode,type,box]
1
- mode
: string (treatment of hidden parts)
2
- mode > 0
the hidden parts of the surface are removed and the surface is painted
with color mode.
- mode = 0
the hidden parts of the surface are drawn.
- mode < 0
only the shadow of the surface is painted with color or pattern
-mode.
1
- type
: scaling
2
- if type = 0
the plot is made using the current 3D scaling ( set by a previous call to
param3d, plot3d, contour, plot3d1)
- if type = 1
the boundaries are specified by the value of the parameter
ebox=[xmin,xmax,ymin,ymax,zmin,zmax]
- else
the boundaries are computed with the given datas.
1
- box
: frame display around the plot.
2
- box=0
nothing is drawn around the plot
- box=1
unimplemented ( like box=0 )
- box=2
only the axes behind the surface are drawn
- box=3
a box surrounding the surface is drawn and captions are added
- box=4
a box surrounding the surface is drawn, captions are added and axes too.
1
0
DESCRIPTION :
plot3d(x,y,z,theta,alpha,leg [,flag,ebox]) draw the surface
z=f(x,y) defined by a matrix of coordinates.
plot3d(xf,yf,zf,theta,alpha,leg [,flag,ebox]) draw the non
projectable surface 0=f(x,y,z) defined by a set of facets.
xf(:,i),yf(:,i),zf(:,i) are respectively the x-axis,y-axis and z-axis coordinates of the ith facet.
Enter the command plot3d() to see a demo.
EXAMPLE :
plot3d(1:10,1:20,10*rand(10,20),35,45,"X@Y@Z",[2,2,3])
xbasc();
t=(0:0.3:2*%pi)';zmat=sin(t)*cos(t');
[xx,yy,zz]=genfac3d(t,t,zmat);
plot3d([xx xx],[yy yy],[zz 4+zz]);
xbasc();
plot3d([xx xx],[yy yy],list([zz zz+4],[4*ones(1,400) 5*ones(1,400)]))
See Also :
plot3d1
X, genfac3d
X, hist3d
X, geom3d
X, param3d
X
Author :
J.Ph.C.
2.56 plot3d1 gray or color level plotting of a surface.
DESCRIPTION :
plot3d1(x,y,z,[theta,alpha,leg,flag,ebox])
plot3d1(xf,yf,zf [,theta,alpha,leg [,flag,ebox]])
PARAMETERS :
see plot3d for a full description. There's just a slight
difference, the value of the mode parameter is unused, only its
sign. If the sign is negative the grid is not drawn.
DESCRIPTION :
plots a surface z=f(x,y) (points)
with colors depending on the z-level of the surface.
Enter the command plot3d1() to see a demo or fac3d1().
EXAMPLE :
plot3d1(1:10,1:20,10*rand(10,20),35,45,"X@Y@Z",[2,2,3]);
xbasc();
plot3d1(1:10,1:20,10*rand(10,20),35,45,"X@Y@Z",[-2,2,3]);
xbasc();
t=(0:0.3:2*%pi)';zmat=sin(t)*cos(t');
[xx,yy,zz]=genfac3d(t,t,zmat);
plot3d1([xx xx],[yy yy],[zz 4+zz]);
xbasc();
plot3d1([xx xx],[yy yy],list([zz zz+4],[4*ones(1,400) 5*ones(1,400)]))
Author :
J.Ph.C.
2.57 plotframe graphic frame with scaling and grids
CALLING SEQUENCE :
plotframe(rect,tics [,arg_opt1,arg_opt2,arg_opt3])
PARAMETERS :
- rect
:
vector [xmin,ymin,xmax,ymax] made of x and y bounds.
- tics
:
vector [nx,mx,ny,my] where mx, nx (resp. my, ny) are
the number of x-axis (resp. y-axis) intervals and subintervals.
- arg_optX
: optional arguments up to three and choosen among.
1
- flags
:
vector [wantgrids,findbounds] where wantgrids is a boolean
variable (%t or %f) which indicates gridding.
findbounds is a boolean variable. If findbounds is %t,
the bounds given in rect are allowed to be slightly modified
( in fact always increased )
in order to have simpler graduations (then tics(2),tics(4) are ignored).
- captions
: vector of 3 character strings [title, x-leg, y-leg].
- subwin
: a vector of size 4 (sub window definition)
The sub window is specified with the
parameter subwwin=[x,y,w,h] ( Upper-Left Width Height ).
The values in subwin are specified using proportion of the width
or height of the current graphic window ( See xsetech ).
0
DESCRIPTION :
This function is used with plotting functions plot2d,
plot2d1,... to set a graphic frame. This function is
used before plot2d... which should be invoked with
the "000" superposition mode.
EXAMPLE :
x=[-0.3:0.8:27.3]';
y=rand(x);
rect=[min(x),min(y),max(x),max(y)];
tics=[4,10,2,5]; //4 x-intervals and 2 y-intervals
plotframe(rect,tics,[%f,%f],['My plot','x','y'],[0,0,0.5,0.5]);
plot2d(x,y,2,'000')
plotframe(rect,tics,[%t,%f],['My plot with grids','x','y'],[0.5,0,0.5,0.5]);
plot2d(x,y,3,'000')
plotframe(rect,tics,[%t,%t],...
['My plot with grids and automatic bounds','x','y'],[0,0.5,0.5,0.5]);
plot2d(x,y,4,'000')
plotframe(rect,tics,[%f,%t],...
['My plot without grids but with automatic bounds','x','y'],...
[0.5,0.5,0.5,0.5]);
plot2d(x,y,5,'000');
xset('default');
See Also :
plot2d
X, graduate
X, xtitle
X, plot2d1
X, plot2d2
X
2.58 plzr pole-zero plot
CALLING SEQUENCE :
plzr(sl)
PARAMETERS :
DESCRIPTION :
produces a pole-zero plot of the linear system
sl (syslin list)
EXAMPLE :
s=poly(0,'s');
n=[1+s 2+3*s+4*s^2 5; 0 1-s s];
d=[1+3*s 5-s^3 s+1;1+s 1+s+s^2 3*s-1];
h=syslin('c',n./d);
plzr(h);
See Also :
trzeros
X, roots
X, syslin
X
2.59 printing printing scilab graphics
CALLING SEQUENCE :
Blatexpr xscale yscale filename.ps
BEpsf filename.ps
Blpr "Title" filename1.ps filename2.ps ... filenamen.ps | lpr
DESCRIPTION :
The scilab graphics can be saved with the xbasimp command into unix files. The Scilab command :
xbasimp(xx,'des.ps',0)
will save the graphics recorded in the graphic window xx in the
file des.ps.xx. This file can't be directly send to a Postscript
printer and a set of programs ( in the bin Scilab directory ) are
given with Scilab to print it :
- BEpsf
: The BEpsf command will create an Epsf file from your des.ps.xx under the name des.epsf, this Epsf file can be printed on a
Postscript printer or inserted into an other Postscript document.
- Blatexpr
: The Blatexpr command will create an Epsf file from your
des.ps.xx
mv des.ps.xx des.ps
Blatexpr 1.0 1.0 des.ps
under the name des.epsf and a LaTeX file
des.tex. The file des.tex can be inserted in a LaTeX
file in order to get the latex figure as follows ( the postscript
file is inserted with the special command of LaTeX )
\input des.tex
\dessin{caption}{label}
- Blpr
: The Blpr command is used to print a set of graphics on a same
sheet of paper. For example to print two graphics on a unique page, one
can use :
Blpr "Two graphics" file1.ps.0 file2.ps.1 | lpr
- Blatexprs
: The Blatexprs command is used to insert in a single LaTeX figure
a set of Scilab Graphics
Blatexprs res file1.ps.0 file2.ps.1
will create two files res.ps and res.tex. The file res.tex is used as in the Blatexpr command in order to get the figure.
See Also :
xbasimp
X
2.60 rotate geometric rotation of a set of points
CALLING SEQUENCE :
[xy1]=rotate(xy,[theta,orig])
PARAMETERS :
- xy,xy1
: matrices of size (2,.)
- theta
: real (angle en radian) , (default value=0)
- orig
: center of the rotation [0;0] if omitted
DESCRIPTION :
xy1(:,i) = M(theta) *xy(:,i) + orig where M stands for a rotation matrix of angle theta
EXAMPLE :
xsetech([0,0,1,1],[-1,-1,1,1])
xy=[(0:0.1:10);sin(0:0.1:10)]/10;
for i=2*%pi*(0:10)/10,[xy1]=rotate(xy,i);
xpoly(xy1(1,:),xy1(2,:),"lines")
end
2.61 scaling affine transform of a set of points
CALLING SEQUENCE :
[xy1]=scaling(xy,factor,orig)
PARAMETERS :
- xy,xy1
: matrices of size (2,.)
- factor
: real scalar (linear transform coef)
- orig
: shift vector (default value =[0;0] )
DESCRIPTION :
xy1(:,i) = factor *xy(:,i) + orig
2.62 sd2sci gr_menu structure to scilab instruction convertor
CALLING SEQUENCE :
txt=sd2sci(sd [,sz [,orig]])
PARAMETERS :
- sd
: data structure build by gr_menu.
- sz
: vector of number or strings with two components, give the x and y
zoom factors
- orig
: vector of number or strings with two components, give the origin
translation vector
DESCRIPTION :
given a sd data structure generated by gr_menu sd2sci forms a vector of scilab instructions corresponding to
the graphic edited by gr_menu.
The optional parameters sz and orig allows to zoom and
shift the initial graphic.
If sz or orig are given by strings generated instructions
are relative use then as formal expressions.
Author :
Serge Steer INRIA 1988
See Also :
gr_menu
X, execstr
X
2.63 secto3d 3D surfaces conversion
CALLING SEQUENCE :
[m[,x]]=secto3d(seclist,npas)
[m]=secto3d(seclist ,x)
PARAMETERS :
- seclist
: a list whose elements are (2,.) matrices
- npas
: an integer
- m
: a matrix
- x
: a vector
DESCRIPTION :
Considering a surface given through a list seclist of sections in the
(x,z) plane [m [,x]]=secto3d(seclist [,npas]) returns a matrix m which contains a regular discretization of the surface.
- -
The i-th row of the matrix m corresponds to the i-th section
- -
The j-th column of m corresponds to the x(j)
Each section seclist(i) is described by a (2,.) matrix which gives respectively the x
and z coordinates of points.
[m]=secto3d(seclist ,x) : in that case the x-vector gives the discretization
of the x-axis for all the sections
See Also :
plot3d
X
Author :
Steer S.
2.64 sgrid s-plane grid lines.
CALLING SEQUENCE :
sgrid()
sgrid('new')
sgrid(zeta,wn [,color])
DESCRIPTION :
Used in conjonction with evans,
plots lines of constant damping ratio (zeta)
and natural frequency (wn).
1
- sgrid()
: add a grid over an existing continuous s-plane root
with default values for zeta and wn.
- sgrid('new')
: clears the graphic screen and then plots a default
s-plane grid
- sgrid(zeta,wn [,color])
: same as sgrid() but uses the provided damping ratio and
natural frequency.
0
EXAMPLE :
H=syslin('c',352*poly(-5,'s')/poly([0,0,2000,200,25,1],'s','c'));
evans(H,100)
sgrid()
sgrid(0.6,2,7)
See Also :
evans
X
2.65 square sets scales for isometric graphics
CALLING SEQUENCE :
square(xmin,ymin,xmax,ymax)
PARAMETERS :
- xmin,xmax,ymin,ymax
: four real values
DESCRIPTION :
square(xmin,ymin,xmax,ymax) is used to set the graphic scales in order
to have isometric scales on the X and Y axes. The requested values
xmin, xmax, ymin, ymax are the boundaries of the graphic frame
and this function changes the graphic window dimensions in order to
get an isometric plot. This function sets the current graphic scales
and can be used in conjunction with graphic routines which request
the current graphic scale ( fstrf="x0y" in plot2d ).
See Also :
isoview
X
Author :
Steer S.
2.66 titlepage display a matrix of strings
CALLING SEQUENCE :
titlepage(str)
PARAMETERS :
DESCRIPTION :
titlepage(str) displays the matrix str in the current graphic window
with a size font as large as possible
See Also :
xtitle
X
Author :
S. S.
2.67 winsid return the list of graphic windows id
CALLING SEQUENCE :
[x]=winsid()
PARAMETERS :
DESCRIPTION :
This function is used to get the list of graphic windows id.
2.68 xarc draws a part of an ellipsis
CALLING SEQUENCE :
xarc(x,y,w,h,a1,a2)
PARAMETERS :
- x,y,w,h
: real (rectangle def)
- a1,a2
: real (angle def)
DESCRIPTION :
Draws a portion of an ellipsis contained in the rectangle (x,y,w,h) ( Upper-Left point, Width, Height), and in the sector delimited by
the angle alpha1 and the angle alpha1+alpha2. alpha1 and alpha2 are
given respectively by a1/64 degrees and a2/64 degrees.
This function uses the current graphic state and graphic scale.
which can be set by calling a high level drawing function such as plot2d.
EXAMPLE :
// isoview scaling
plot2d(0,0,-1,"031"," ",[-2,-2,2,2])
xset("dashes",3);
xarc(-1,1,2,2,0,90*64)
xarc(-1.5,1.5,3,3,0,360*64)
See Also :
xarcs
X, xfarc
X
Author :
J.Ph.C..
2.69 xarcs drawing a set of ellipsis
CALLING SEQUENCE :
[]=xarcs(arcs,[style])
PARAMETERS :
- arcs
: matrix of size (6,n) (ellipsis description)
- style
: vector of size (1,n) giving the style to use ( set xset("dashes",...).
DESCRIPTION :
draws a set of ellipsis described by arcs.
arcs= [ x,y,w,h,a1,a2 ; x,y,w,h,a1,a2 ;.....] ' : each ellipsis is defined by the
6 parameters (x,y,w,h,a1,a2) (see xarc)
style(i) gives the dash style which must be used to draw the ellipsis number i.
EXAMPLE :
plot2d(0,0,-1,"031",' ',[-1,-1,1,1])
set_arcs=[ -1.0 0.0 0.5 // upper left x
1.0 0.0 0.5 // upper left y
0.5 0.5 0.5 // widths
0.5 0.5 0.5 // height
0.0 0.0 0.0 // angle 1
360*64 360*64 360*64] // angle 2
xarcs(set_arcs,[1,2,3])
Author :
J.Ph.C.
2.70 xarrows draw a set of arrows
CALLING SEQUENCE :
[]=xarrows(nx,ny,[arsize,style])
PARAMETERS :
- nx
: real matrix of size (n1,n2)
- ny
: real matrix of size (n1,n2)
- arsize
: real scalar (size of the arrow head). The default value can be obtained
by setting arsize to value -1.0.
- style
: a matrix of size n or a scalar. If style is a positive scalar
it gives the dash style to use for all arrows, if it is a negative scalar
then current dash style is used, if it is a vector style[i] gives the style to use for arrow i.
DESCRIPTION :
This function draws a set of arrows which are given by the vector or
matrices nx and ny.
The ith arrow is defined by (nx(i),ny(i))-->(nx(i+1),ny(i+1)).
nx, ny can also be matrices :
nx=[ xi_1,x1_2,...; xf_1,xf_2,...]
ny=[ yi_1,y1_2,...; yf_1,yf_2,...]
in which case the arrows are (xi_k,yi_k)->(xf_k,yf_k)
This function uses the current graphic scale
which can be set by calling a high level drawing function such as plot2d.
EXAMPLE :
x=2*%pi*(0:9)/8;
x1=[sin(x);9*sin(x)];
y1=[cos(x);9*cos(x)];
plot2d([-10,10],[-10,10],[-1,-1],"022");
xset('clipgrf')
xarrows(x1,y1,1,1:10);
xset('clipoff')
See Also :
plot2d
X, xchange
X
Author :
J.Ph.C..
2.71 xaxis draws 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
: a real vector of size 3 (size of the intervals, the small and big tics)
DESCRIPTION :
Draw an axis in the alpha (in degree ) direction; nsteps ([n1,n2]) gives the
number of big and small intervals separated by tics. size=[s1,s2,c1] : s1 gives
the size of the intervals , s2 gives the size of the small tics along the axis and
s2*c1 is the size of the big tics. The size are given using the
Scilab current x-scale and y-scale and are given as dimensions along the drawn axis.
ex : n1=3,n2=2,alpha =0
(s2*c1)
| (s2) | | |
|______|_____|_____|______|_____|_____|
s1
EXAMPLE :
plot2d((1:0.1:10),sin(1:0.1:10))
xaxis(-90,[2,5],[0.1,0.1,2],[8,0])
xaxis(0,[2,3],[0.5,0.1,2],[5,0])
Author :
J.Ph.C..
2.72 xbasc clear a graphic window and erase associated recorded graphics
CALLING SEQUENCE :
xbasc([win_num])
PARAMETERS :
- win_num
: integer scalar or vector
DESCRIPTION :
clears the graphic window win_num and erase the recorded graphics.
If win_num is omitted, it's the current graphic window.
win_num can also be a vector of window Id to clear a set of windows
See Also :
xclear
X
2.73 xbasimp send graphics to a postscript printer or in a file
CALLING SEQUENCE :
xbasimp(win_num,[filen,printer])
PARAMETERS :
- win_num
: an integer scalar or vector
- filen
: string (Postscript file name). (default value=file). The window number
is appended to the filen.
- printer
: string (Printer name). if printer is present or if there's only one argument in the
calling sequence, the created file is printed on printer printer.
DESCRIPTION :
This function will send the recorded graphics of the
window win_num in the Postscript file filen and will print the Postscript file with the
command Blpr. This function will work only if the selected
driver is "Rec"
If fwin_num is a vector several files are generated,one for each
selected window (with names filenxx), and the files are printed
on a unique page with the command Blpr,
The window number is appended to filen.
See Also :
printing
X
2.74 xbasr redraw a graphic window
CALLING SEQUENCE :
xbasr(win_num)
DESCRIPTION :
This function is used to redraw the content of the graphic
window of id win_num. It works only with the driver "Rec".
See Also :
xtape
X, driver
X
Author :
J.Ph.C.
2.75 xchange coordinates transform
CALLING SEQUENCE :
[x1,y1,rect]=xchange(x,y,dir)
PARAMETERS :
- x,y
: two matrices of size (n1,n2) (coordinates of a set of points)
- x1,y1
: two matrices of size (n1,n2) (coordinates of the set of points )
- rect
: a vector of size 4 (values in pixel of the coordinates
of the rectangle in which the scale was fixed)
DESCRIPTION :
After having used a graphic function, this function allows one to change real
coordinates into pixel coordinates and vice-versa,
according to the value of the parameter dir.
dir = 'f2i' or 'i2f' ( float to int or int to float)
x1,y1 are the coordinates of the set of points described by x,y after
the coordinate change.
Author :
J.Ph.C..
2.76 xclea erase a rectangle on a graphic window
CALLING SEQUENCE :
xclea(x,y,w,h)
PARAMETERS :
- x,y,w,h
: four real values (rectangle def)
DESCRIPTION :
clears on the current graphic window the rectangle [x,y,w,h] ( Upper left point , width,height) using the current graphic scale.
Author :
J.Ph.C.
2.77 xclear clear a graphic window
CALLING SEQUENCE :
xclear([window-id])
PARAMETERS :
- window-id
: integer vector
DESCRIPTION :
Without any argument, this function wipes out the current window.
Otherwise it wipes out the graphic windows whose numbers are included
in the vector window-id, for example xclear(1:3).
If one of the windows does not
exist then it is automatically created.
Warning : in recording mode the graphic command xclear wipes out
the window, but it doesn't wipe out the recorded commands.
In this case one must use the function xbasc.
See Also :
xbasc
X
Author :
J.Ph.C.
2.78 xclick wait for a mouse click
CALLING SEQUENCE :
[c_i,c_x,c_y]=xclick([flag])
[c_i,c_x,c_y,c_w]=xclick([flag])
[c_i,c_x,c_y,c_w,c_m]=xclick([flag])
PARAMETERS :
- c_i
: integer (button number)
- c_x,c_y
: real scalars (position)
- c_w
: integer (window number)
- c_m
: Character string (menu callback)
- flag
: an integer. If present, the click event queue is not cleared when entering xclick
DESCRIPTION :
if called with 3 lhs arguments waits for a mouse click in the current
graphic window
if called with 4 or 5 lhs arguments waits for a mouse click in any graphic
window
returned values:
- c_i
: an integer which gives the number of the mouse button that was pressed [0,1,2] (for [left,middle,right]) or i=-1 in case of problems with xclick.
- c_x,c_y
: the coordinates in the current graphic scale
of the position of the mouse click.
- c_w
: the window number where the click has occurred
- c_m
: Character string associated with a dynamic menu. If xclick returns
due to a click on a menu, c_i, c_x, c_y, c_w take
arbitrary values.
KNOWN TROUBLES :
This function can return the message
Can't grab the pointer if the graphic window is iconified when
calling the function xclick.
See Also :
locate
X
Author :
J.Ph.C.
2.79 xclip set a clip zone
CALLING SEQUENCE :
xclip([x,y,w,h])
xclip(rect)
xclip("clipgrf");
PARAMETERS :
- x,y,w,h
: four float values
- rect
: a vector of size (1,4)
DESCRIPTION :
Sets a clip region given by the coordinates, in the current
graphic scaling, of a rectangle (x,y,w,h) (Upper-Left point,Width aba Height). If only one argument is used it stands
for a rectangle specification rect=[x,y,w,h].
xclip("clipgrf") is used to clip the usual graphic rectangle.
To unclip a region use the command xclip()
EXAMPLE :
x=0:0.2:2*%pi;
x1=[sin(x);100*sin(x)];
y1=[cos(x);100*cos(x)];
y1=y1+20*ones(y1);
// No clip
plot2d([-100,500],[-100,600],[-1,-1],"022");
xsegs(10*x1+200*ones(x1),10*y1+200*ones(y1));
xbasc()
//
// Rect clip
xbasc();plot2d([-100,500],[-100,600],[-1,-1],"022");
xrect(150,460,100,150);
xclip(150,460,100,150);
xsegs(10*x1+200*ones(x1),10*y1+200*ones(y1));
//
// usual graphic rectangle clip
xbasc();plot2d([-100,500],[-100,600],[-1,-1],"022");
xclip("clipgrf");
xsegs(10*x1+200*ones(x1),10*y1+200*ones(y1));
// clipping off
xclip()
Author :
J.Ph.C.
2.80 xdel delete a graphic window
CALLING SEQUENCE :
xdel([win-num])
DESCRIPTION :
Deletes the graphic window win-num if the name is specified
or the current graphic window otherwise
Author :
J.Ph.C.
2.81 xend ends a graphic session
CALLING SEQUENCE :
xend()
DESCRIPTION :
This command is used to end a graphic session. Under the Postscript or
Xfig drivers this command closes the current
file which was opened by the command xinit.
Author :
J.Ph.C.
2.82 xfarc fill a part of an ellipsis
CALLING SEQUENCE :
[]=xfarc(x,y,w,h,a1,a2)
PARAMETERS :
- x,y,w,h
: real scalars (rectangle def)
- a1,a2
: real scalars (angle def)
DESCRIPTION :
Fills a portion of an ellipsis contained in the rectangle (x,y,w,h) ( upper-left point, width, height), and in the sector delimited by
the angle alpha1 and the angle alpha1+alpha2. alpha1 and alpha2 are
given respectively by a1/64 degrees and a2/64 degrees.
This function uses the current graphic state
which can be set by calling a high level drawing function such as plot2d.
EXAMPLE :
// isoview scaling
plot2d(0,0,-1,"031"," ",[-2,-2,2,2])
xfarc(-0.5,0.5,1,1,0,90*64)
xset("pattern",2)
xfarc(0.5,0.5,1,1,0,360*64)
See Also :
xarcs
X, xarc
X
Author :
J.Ph.C..
2.83 xfarcs filling a set of ellipsis
CALLING SEQUENCE :
[]=xfarcs(arcs,[fill])
PARAMETERS :
- arcs
: matrix of size (6,n) (ellipsis description)
- style
: vector of size (1,n) giving the style to use ( set xset("dashes",...).
DESCRIPTION :
fill a set of ellipsis described by arcs.
arcs= [ x,y,w,h,a1,a2 ; x,y,w,h,a1,a2 ;.....] ' : each ellipsis is defined by the
6 parameters (x,y,w,h,a1,a2) (see xarc)
fill(i) gives the fill pattern or color which must be used to draw the ellipsis number i.
EXAMPLE :
plot2d(0,0,-1,"031",' ',[-1,-1,1,1])
set_arcs=[ -1.0 0.0 0.5 // upper left x
1.0 0.0 0.5 // upper left y
0.5 0.5 0.5 // widths
0.5 0.5 0.5 // height
0.0 0.0 0.0 // angle 1
360*64 360*64 360*64] // angle 2
xfarcs(set_arcs,[1,2,3])
Author :
J.Ph.C.
2.84 xfpoly fill a polygon
CALLING SEQUENCE :
[]=xfpoly(xv,yv,[close])
PARAMETERS :
- xv, yv
: two vectors of size n (the points of the polygon)
- close
: an integer
DESCRIPTION :
Fills a polygon with the current pattern. If close is equal to 1 a point is added to the polyline
xv,yv to define a polygon.
EXAMPLE :
x=sin(2*%pi*(0:5)/5);
y=cos(2*%pi*(0:5)/5);
plot2d(0,0,-1,"010"," ",[-2,-2,2,2])
xset("pattern",5);
xfpoly(x,y)
xset("default");
See Also :
xfpolys
X
Author :
J.Ph.C.
2.85 xfpolys fill a set of polygons of the same size
CALLING SEQUENCE :
[]=xfpolys(xpols,ypols,[fill])
PARAMETERS :
- xpols,ypols
: two matrices of size (n1,n2) (polygon def)
- fill
: vector of size n2 (number of polygons) (pattern id's).
DESCRIPTION :
fills a set of polygons of the same size defined by
the two matrices xpols,ypols . xpols= [ xpol1;xpol2;...]',
each column of the matrix xpols gives the x-values of the points
of a polygon (i.e ypols).
fill(i) gives the
id of the pattern for filling the polygon number i
- -
if fill(i) < 0, the polygon is filled with pattern
-fill(i).
- -
if fill(i) == 0, the polyline is only drawn
with the current dash style ( or current color ).
- -
if fill(i) > 0, the polygon is filled with the pattern fill(i).
Then its contour is drawn with the current dash (or color) and closed if necessary.
EXAMPLE :
plot2d(0,0,[-1],"012"," ",[0,-10,210,40]);
x1=[0,10,20,30,20,10,0];
y1=[15,30,30,15,0,0,15];
xpols=[x1;x1;x1;x1]';xpols=xpols + [0,60,120,180].*.ones(x1)';
ypols=[y1;y1;y1;y1]';
lpat=xget("lastpattern");
// setting the current dash (or line color)
xset("dashes",5);
xfpolys(xpols,ypols,[-1,0,1,2]);
xset("default");
Author :
J.Ph.C.
2.86 xfrect fill a rectangle
CALLING SEQUENCE :
[]=xfrect(x,y,w,h)
PARAMETERS :
- x,y,w,h
: real scalars (rectangle def)
DESCRIPTION :
fills a rectangle [x,y,w,h] (upper-left point, width, height) using current
scale and pattern
EXAMPLE :
plot2d(0,0,-1,"010"," ",[-2,-2,2,2])
xset("pattern",5);
xfrect(-1,1,2,2)
xset("default");
Author :
J.Ph.C.
2.87 xget gets current values of the graphic context
CALLING SEQUENCE :
[x1]=xget(str [,flag])
xget()
PARAMETERS :
- str
: string
- flag
: optional. Set to 1 gives a verbose mode
DESCRIPTION :
this function is used to get values from the graphic context
on the topic specified by the string str. When called
no arguments, a choice menu is created showing the current values and
changes can be performed through toggle buttons
- number=xget("alufunction")
: used to get the logical function number used for drawing.
1
- 0
: function " 0 ",
- 1
: function " src AND dst "
- 2
: function " src AND NOT dst "
- 3
: function " src ", (Default value)
- 4
: function " NOT src AND dst "
- 5
: function " dst ",
- 6
: function " src XOR dst ",
- 7
: function " src OR dst ",
- 8
: function " NOT src AND NOT dst ",
- 9
: function " NOT src XOR dst ",
- 10
: function " NOT dst ",
- 11
: function " src OR NOT dst ",
- 12
: function " NOT src ",
- 13
: function " NOT src OR dst ",
- 14
: function " NOT src OR NOT dst ",
- 15
: function " 1 ";
0
str=xset("auto clear")
: to get the auto clear status ("on" or "off").
- color=xget("background")
: to get the background color of the current graphic window.
- rect=xget("clipping")
: get the clipping
zone rectangle rect=[x,y,w,h] (Upper-Left point Width Height).
- cmap=xget("colormap")
: get the colormap used for the current graphics window as a m x 3
RGB matrix
- dash=xget("dashes")
: get the dash style dash=[dash_number,v]
v contains the definition of the dash
- font=xget("font")
: get font=[fontid,fontsize] the current font and its current size.
- color=xget("foreground")
: to fix the foreground color of the current graphic window.
- str=xget("fpf")
: to get the floating point format for number display in
contour functions. Note that str=='' when default format is used.
- color=xget("hidden3d")
: set the color number for ``hidden'' faces in plot3d.
- pat=xget("lastpattern")
the id of the last available pattern or color, with the current colormap of
the current window. In fact pat+1 and pat+2 are also available and
stand respectively for black and white pattern.
- type=xget("line mode");
This function is used to get the line drawing mode.
type=1 :Absolute mode,type=0 relative mode
(Warning : the mode type=0 is buged )
- mark=xget("mark")
: mark=[markid,marksize] the current mark and current mark size.
- pat=xget("pattern")
: to get the current pattern or the current colo. pat is an integer
in the range [1,last]. When one use a black and white Scilab, 0 is used for black filling and
last for white. The value of last can be obtained with xget("lastpattern").
- value=xget("thickness")
: get the thickness of lines in pixel ( 0 and 1 have the same meaning : 1 pixel thick)
- dim=xget("wdim")
: dim=[width,height] the width and height of the current graphic window.
- pos=xget("wpos",x,y);
: pos=[x,y] the position of the upper left point of the graphic window.
- win=xget("window")
Get the current window to the window win
- flag=xget("use color")
if flag=1 then xset("pattern",.) or xset("dashes",.) will be used so
as to change the default color for drawing or for filling patterns.
If flag=0 then we switch back to the gray and dashes mode.
See Also :
xset
X, colormap
X
REFERENCE :
X11 documentation
Author :
J.Ph.C.
2.88 xgetech get the current graphic 2d scale
CALLING SEQUENCE :
[frect1,frect,[logflag]]=xgetech()
PARAMETERS :
- frect1, frect
: real vectors (rect. def)
- logflag
: a string of size 2 "xy".
DESCRIPTION :
This function returns the current graphic scale.
If one uses the current graphic scale, the points in the
frect rectangle [xmin,ymin,xmax,ymax] will be drawn in the
the region of the current graphic window specified by frect1.
frect1=[x,y,w,h] ( Upper-Left Width Height ) describes a region inside
the graphic window. The values in wrect1 are specified using proportion
of the width or height of the graphic window.
frect1=[0,0,1.0,1.0] means that all the graphic window will be used.
frect1=[0.5,0,0.5,1.0] means that the graphic region will be the right
half of the graphic window.
The logflag is a string of size 2 "xy", where x and y can be "n" or "l".
It gives information on the log scale status for the current scale, "n" stands for
normal and "l" for logscale. x is for the x-axis and y for the y-axis.
See Also :
xsetech
X
Author :
J.Ph.C.
2.89 xgetmouse get current position of the mouse
CALLING SEQUENCE :
rep=xgetmouse([flag])
PARAMETERS :
- rep
: a three vector: [x,y,ibutton]
- flag
: an integer. If present, the click event queue is not cleared when entering xclick
DESCRIPTION :
If the mouse is located in the current graphic window xgetmouse returns
in rep the current mouse position (x,y) and the value ibutton.
The ibutton value indicate the button action at this point
if ibutton==-1 then no button clicked
if ibutton==0,1 or 2 then the left, middle or right button clicked
If the mouse is not located in the current graphic window xgetmouse waits
EXAMPLE :
xselect();xbasc(); xsetech([0 0 1 1],[0 0 100 100])
xset('alufunction',6)
xtitle(' drawing a rectangle ');
[b,x0,y0]=xclick();rep=[x0,y0,-1];x=x0;y=y0
xrect(x0,y0,x-x0,y-y0);
while rep(3)==-1 then
rep=xgetmouse(0);
xrect(x0,y0,x-x0,y0-y);
x=rep(1);y=rep(2);
xrect(x0,y0,x-x0,y0-y);
end
xset('alufunction',3)
See Also :
locate
X, xclick
X
Author :
S. Steer
2.90 xgrid add a grid on a graphic
CALLING SEQUENCE :
xgrid([style])
PARAMETERS :
DESCRIPTION :
Adds a grid on a 2D plot. style stands for the dash
style or color to use for the grid plotting.
EXAMPLE :
plot2d()
xgrid()
See Also :
xset
X, plot2d
X
Author :
J.Ph.C..
2.91 xinfo add an info string on a graphic window
CALLING SEQUENCE :
xinfo(string)
PARAMETERS :
- string
: a scilab string.
DESCRIPTION :
This function is used to add a sentence on the current graphic window.
2.92 xinit initialisation of a graphic driver
CALLING SEQUENCE :
xinit([driver-name])
PARAMETERS :
- driver-name
: string (default value : DISPLAY value or 'unix:0.0')
DESCRIPTION :
Initialisation of a given driver.
For X-Window
driver-name must be a string which gives the name of a display
and this function creates a new graphic window. If the argument is omitted
the value of the environment variable DISPLAY is used if it exists or
the value 'unix:0.0' is used.
For Postscript or Xfig driver-name is a name of a file. The graphics operations
will be recorded in the specified file.
Author :
J.Ph.C.
2.93 xlfont load a font in the graphic context
CALLING SEQUENCE :
xlfont(font-name,font-id)
PARAMETERS :
- font-name
: string (name of the font family)
- font-id
: integer
DESCRIPTION :
This function is used to load an X11 font at different sizes
inside the graphic context.
- font-name
: can be of 2 types
1
- -
if it contains the character '%', it is supposed to be an
X11 font name with %s in the size field of the name, for example
font-name="-b&h-lucidabright-demibold-r-normal--%s-*-75-75-p-*-iso8859-1"
- -
if it doesn't contain the character '%' ,it is supposed
to be an alias name and the fonts aliased by font-name08,...,font-name24 are
loaded.
- font-id
: the font font-name at sizes 08 10 12 14 18 24
is loaded in the graphic context with the Scilab Id font-id.
0
See Also :
xset
X
REFERENCE :
X11 Font manual.
Author :
J.Ph.C..
2.94 xload load a saved graphic
CALLING SEQUENCE :
xload('file-name' [, win-num] )
PARAMETERS :
- win-num
: an integer ( optional argument ) which stands for the graphic window
in which the graphics are to be loaded.
DESCRIPTION :
This function is used to reload the graphics contained in the file 'file-name' in the graphic-window win-num.
The graphics are stored in a binary file in a machine independent way ( using the
xdr library).
See Also :
xsave
X
Author :
J.Ph.C..
2.95 xnumb draw numbers on a graphic
CALLING SEQUENCE :
xnumb(x,y,nums,[flag,angle])
PARAMETERS :
- x,y,nums
: vectors or matrices of same size
- flag
: an integer value
- angle
: a vector of the same size as x,y,nums
DESCRIPTION :
Displays the value of nums[i] using the current number format
at position x[i],y[i] in the current scale.
if flag is 1 a frame box is added around the strings.
if angle is present it's a vector. angle[i] gives the slope
in degree (clockwise) to use for the display of the string.
EXAMPLE :
plot2d([-100,500],[-100,600],[-1,-1],"022");
x=0:100:200;
xnumb(x,500*ones(x),[10,20,35],1);
Author :
J.Ph.C.
2.96 xpause suspends Scilab
CALLING SEQUENCE :
xpause(microsecs)
DESCRIPTION :
Synchronises the X11-display and
suspends the current process for the number of microseconds
specified by the argument. The actual suspension time may
be an arbitrary amount longer because of other activity in
the system, or because of the time spent in processing the
call.
Author :
J.Ph.C.
2.97 xpoly draw a single polyline
CALLING SEQUENCE :
[]=xpoly(xv,yv,dtype[,close])
PARAMETERS :
- xv, yv
: two matrices of the same size (p,n) (points of the polyline)
- dtype
: string (drawing style)
- close
: if close = 1, the polyline is closed. (default value is 0)
DESCRIPTION :
draws a single polyline described by (xv,yv). If xv and yv are matrices
they are internally considered as a vector using the Fortran internal storage convention.
dtype can be "lines" for using the current line style or "marks" for using
the current mark to draw the polyline.
EXAMPLE :
x=sin(2*%pi*(0:5)/5);
y=cos(2*%pi*(0:5)/5);
plot2d(0,0,-1,"010"," ",[-2,-2,2,2])
xset("dashes",5);
xpoly(x,y,"lines",1);
xset("default");
See Also :
xpolys
X
Author :
J.Ph.C.
2.98 xpolys draw a set of polylines
CALLING SEQUENCE :
[]=xpolys(xpols,ypols,[draw])
PARAMETERS :
- xpols, ypols
: matrices of size (p,n)
- draw
: vector of size n
DESCRIPTION :
Draws a set of polyline using marks or dashed lines, each polyline points
are store in a column of xpols, ypols. xpols =[ xpol1;xpol2;...] '
The style is given by draw :
If draw(i) is negative the mark of id -draw(i) is used to
draw the polyline i ( marks are draw using the current pattern)
If draw(i) is strictly positive the line style (or color) of id abs(draw(i)) is used to draw the
polyline i.
EXAMPLES :
plot2d(0,0,[-1],"012"," ",[0,0,1,1]);
rand('uniform');
xset('pattern',3)
xpolys(rand(3,5),rand(3,5),[-1,-2,0,1,2])
xset('default')
Author :
J.Ph.C.
2.99 xrect draw a rectangle
CALLING SEQUENCE :
[]=xrect(x,y,w,h)
PARAMETERS :
- x,y,w,h
: four real values (rectangle def)
DESCRIPTION :
draws a rectangle [x,y,w,h] (upper-left point, width, height) using current
scale and style.
EXAMPLE :
plot2d(0,0,-1,"010"," ",[-2,-2,2,2])
xset("pattern",5);
xrect(-1,1,2,2)
xset("default");
Author :
J.Ph.C.
2.100 xrects draw or fill a set of rectangles
CALLING SEQUENCE :
[]=xrects(rects,[fill])
PARAMETERS :
- rects
: matrix of size (4,n)
- fill
: vector of size n.
DESCRIPTION :
draws or fills a set of rectangle. each column of rects describes
a rectangle ( Upper Left point, width, height)
rects= [ x,y,w,h ; x,y,w,h ;.....] ' fill(n) gives the pattern to use for filling or drawing the rectangle n.
if fill(n) <0 , the rectangle n is drawn using the line style (or
color)-fill(n)
if fill(n)> 0 , the rectangle n is filled using the pattern (or
color)fill(n).
if fill(n)= 0, the rectangle n is drawn using the current
line style (or color).
EXAMPLE :
plot2d([-100,500],[-50,50],[-1,-1],"022");
cols=[-34,-33,-32,-20:5:20,32,33,34];
step=20;
x=400*(0:14)/14
step = (x(2)-x(1))/2
rects=[x;10*ones(x);step*ones(x);30*ones(x)];
xrects(rects,cols);
xnumb(x,15*ones(x),cols);
Author :
J.Ph.C..
2.101 xrpoly draw a regular polygon
CALLING SEQUENCE :
[]=xrpoly(orig,n,r,[theta])
PARAMETERS :
- orig
: vector of size 2
- n
: integer (number of sides)
- r
: real scalar
- theta
: real (angle in radian) ( 0 is the default value )
DESCRIPTION :
draws a regular polygon of n sides contained in the circle of diameter
r and with the origin of the circle set at point orig.
theta specifies a rotation angle in radian. This function uses
the current graphic scales.
2.102 xs2fig send graphics to a file in Xfig syntax
CALLING SEQUENCE :
xs2fig(win_num,filen [, color])
PARAMETERS :
- win_num
: an integer scalar or vector
- filen
: string (file name).
- color
: an optional integer ( 0 or 1 ).0 for black and white and
1 for color. The default value is to use a value compatible
with the screen status.
DESCRIPTION :
This function will send the recorded graphics of the
window win_num in the file filen in Xfig syntax
This function will work only if the selected
driver is "Rec"
2.103 xsave save graphics in a (reloadable) file.
CALLING SEQUENCE :
xsave('file-name' [, win-num] )
PARAMETERS :
- win-num
: an integer ( optional argument ) which stands for the graphic window
which is to be saved.
DESCRIPTION :
This function is used to save the graphics contained in the graphic-window win-num.
The graphics are stored in a binary file in a machine independent way ( using the
xdr library) and can be reloaded in Scilab with the xload command.
See Also :
xload
X
Author :
J.Ph.C..
2.104 xsegs draw unconnected segments
CALLING SEQUENCE :
xsegs(nx,ny,[style])
PARAMETERS :
- nx,ny
: two matrices of the same size 2*n
- style
: a matrix of size n or a scalar. If style is a positive scalar
it gives the dash style to use for all segments, if it is a negative scalar
then current dash style is used, if it is a vector style[i] gives the style to use for segment i.
DESCRIPTION :
this function draws a set of unconnected segments given by nx,ny which are internally considered as vectors ( using the Fortran storage convention).
The coordinates of the two points defining a segment
are given by two consecutive values of nx and ny.
(nx[i],ny[i])-->(nx[i+1],nx[i+2])
Using matrices of size (2,.) the segments can be defined by
nx=[ xi_1,xi_
xf_1,xf_2,... ]
ny=[ yi_1,yi_2,.....;
yf_1,yf_2,... ]
the segments are then (xi_k,yi_k)->(xf_k,yf_k)
EXAMPLE :
x=2*%pi*(0:9)/8;
x1=[sin(x);9*sin(x)];
y1=[cos(x);9*cos(x)];
plot2d([-10,10],[-10,10],[-1,-1],"022");
xset('clipgrf')
xsegs(x1,y1,1:10);
xset('clipoff')
Author :
C. J.Ph
2.105 xselect raise the current graphic window
CALLING SEQUENCE :
xselect()
DESCRIPTION :
raises the current graphic window and creates it if necessary.
If the current graphic window is iconified nothing is done.
Author :
J.Ph.C.
2.106 xset set values of the graphic context
CALLING SEQUENCE :
xset(choice-name,x1,x2,x3,x4,x5)
xset()
PARAMETERS :
- choice-name
: string
- x1,...,x5
: depending on choice-name
- xset("alufunction",number)
: used to set the logical function for drawing, it works only under X11.
The logical function used is set by x1. The default value is 3.
1
- 0
: function " 0 ",
- 1
: function " src AND dst "
- 2
: function " src AND NOT dst "
- 3
: function " src ",
- 4
: function " NOT src AND dst "
- 5
: function " dst ",
- 6
: function " src XOR dst ",
- 7
: function " src OR dst ",
- 8
: function " NOT src AND NOT dst ",
- 9
: function " NOT src XOR dst ",
- 10
: function " NOT dst ",
- 11
: function " src OR NOT dst ",
- 12
: function " NOT src ",
- 13
: function " NOT src OR dst ",
- 14
: function " NOT src OR NOT dst ",
- 15
: function " 1 ";
0
- xset("auto clear","on"|"off")
: to switch on or off the auto clear mode for graphics.
When the auto clear mode is on an xbasc() operation is
performed before each high level graphic function.
- xset("background",color)
: to fix the background color of the current graphic window.
- xset("clipping",x,y,w,h)
: set the clipping
zone to the rectangle (x,y,w,h) (Upper-Left point Width Height).
This function uses the current scale
- xset("colormap",cmap)
: set the colormap as a m x 3 matrix. m is the number of colors.
Color number i is given as a 3-uple cmap[i,1], cmap[i,2], cmap[i,3]
corresponding respectively to Red, Green and Blue intensity between
0 and 1.
- xset("default")
: reset the graphic context to default values
- xset("dashes",i)
: set the dash style to style i (0 for solid line)
- xset("font",fontid,fontsize)
: to fix the current font and its current size.
- xset("foreground",color)
: to fix the foreground color of the current graphic window.
- xset("fpf",string)
: to fix the floating point format for number display in
contour functions. string is a string giving the format
in C format syntax (for example string="%3f"), use
string='' to switch back to default format.
- xset("hidden3d",colorid)
: set the color number for ``hidden'' faces in plot3d.
- xset("line mode",type);
This function is used to fix the line drawing mode. Absolute mode is fixed withtype=1 an relative mode with type=0. (Warning : the mode type=0 is bugged )
- xset("mark",markid,marksize)
: is used to set the current mark and current mark size.
- xset("pattern",value)
: to set the current pattern for filling functions, value is an integer
projected in the interval [0,whiteid]. 0 is used for black filling and
whiteid for white. The value of whiteid can be obtained with xget("white").
- xset("thickness",value)
: fixes the thickness of lines in pixel ( 0 and 1 have the same meaning : 1 pixel thick)
- xset("wdim",width,height)
: fixes the width and height of the current graphic window. This option is not
used by the postscript driver.
- xset("wpos",x,y);
: fixes the position of the upper left point of the graphic window.
- xset("window",window-number)
Set the current window to the window window-number and creates the window if
it doesn't exists.
- xset("use color",flag)
if flag=1 then xset("pattern",.) or xset("dashes",.) will be used so
as to change the default Color for drawing or for filling patterns.
If flag=0 then we switch back to the gray and dashes mode.
- xset("pixmap",flag)
1
- if
flag=0 the graphics are directly displayed on the screen
- if
flag=1 the graphics are done on a Pixmap and are send to the
graphic window with the command xset("wshow"). The Pixmap is
cleared with the command xset("wwpc") or with the usual command
xbasc().
0
- xset("wshow")
: see xset("pixmap",1) above
- xset("wwpc")
: see xset("pixmap",1) above
DESCRIPTION :
xset is used to set values of the graphic context. When called
no arguments, a choice menu is created showing the current values and
changes can be performed through toggle buttons
See Also :
xget
X, colormap
X
REFERENCE :
X11 documentation
Author :
J.Ph.C.
2.107 xsetech set the sub window of a graphic window to use for graphics
CALLING SEQUENCE :
[]=xsetech(wrect [,frect,logflag])
PARAMETERS :
- wrect
: a vector of size 4 (sub window definition)
- frect
: a vector of size 4 (just like the rect argument of plot2d )
- logflag
: a string of size 2 "xy", where x and y can be "n" or "l". "n" for
normal and "l" for logscale. x is for the x-axis and y for the y-axis.
DESCRIPTION :
This function is mainly used to set the sub window of the graphic window
which will be used for graphics. The sub window is specified with the
parameter wrect=[x,y,w,h] ( Upper-Left Width Height ).
The values in wrect are specified using proportion of the width
or height of the current graphic window. for example
wrect=[0,0,1.0,1.0] means that all the graphic window will be used.
wrect=[0.5,0,0.5,1.0] means that the graphic region will be the right
half of the graphic window.
and can be used in conjunction with graphic routines which request
the current graphic scale (for example strf="x0y" in plot2d ).
frect=[xmin,ymin,xmax,ymax] is used to set the graphic scale and
is just like the rect argument of plot2d. Its default value
is [0,0,1,1].
EXAMPLE :
//In this first example xsetech is used to split the graphic window
//in two parts
// xsetech is used to fix the first sub window
// and the graphic scale
xsetech([0,0,1.0,0.5],[-5,-3,5,3]);
// then we call plot2d with the "001" option to use the graphic scale
// set by xsetech
plot2d((1:10)',(1:10)',1,"001",' ');
// xsetech is used to fix the second sub window
xsetech([0,0.5,1.0,0.5]);
// the graphic scale is set by xsetech to [0,0,1,1] by default
// and we change it with the use of the rect argument in plot2d
plot2d((1:10)',(1:10)',1,"011",' ',[-6,-6,6,6]);
//A second example with four graphics on a single graphic window
xset("font',2,0);
xsetech([0,0,0.5,0.5]);plot3d();
xsetech([0.5,0,0.5,0.5]);plot2d();
xsetech([0.5,0.5,0.5,0.5]);grayplot();
xsetech([0,0.5,0.5,0.5]);histplot();
// back to default values for the sub window
xsetech([0,0,1,1]);
xset("default');
Author :
J.Ph.C.
2.108 xsetm dialog to set values of the graphic context
CALLING SEQUENCE :
xsetm()
DESCRIPTION :
xsetm is used to set values of the graphic context. A choice
menu is created showing the current values and changes can be
performed through toggle buttons.
See Also :
xset
X
REFERENCE :
X11 documentation
Author :
J.Ph.C.
2.109 xstring display a matrix of strings
CALLING SEQUENCE :
[]=xstring(x,y,str,[angle,flag])
PARAMETERS :
- x,y
: real scalars (point coordinates)
- str
: matrix of strings
- angle
: real (angle in degree) (clockwise) (default value =0)
- flag
: integer
DESCRIPTION :
draws a matrix of strings ( each line of the matrix stands for a line of text
and the line elements are separated by a white space) at location x,y ( lower-left point ) in the current graphic scale. angle if given gives the slope in degree
to use for drawing the string. if frame=1 a box is drawn around the string
(only if angle=0 )
EXAMPLE :
plot2d([0;1],[0;1],0)
xstring(0.5,0.5,["Scilab","is" ; "Not","Basilc"])
//Other example
alphabet=['a ','b ','c ','d ','e ','f ','g ',...
'h ','i ','j ','k ','l ','m ','n ',...
'o ','p ','q ','r ','s ','t ','u ',...
'v ', 'w ','x ','y ','z '];
xset('default'); //default graphic parameters
xset("window",1); //set window number to 1
xclear();
plot2d([0;1],[0;2],0);
xstring(0.1,1.8,alphabet) //alphabet
xstring(0.1,1.6,alphabet,20) //angle
xset("font",1,1) //symbol fonts
xstring(0.1,0.1,alphabet)
xset('font',1,3) //change size font
xstring(0.1,0.3,alphabet)
xset('font',1,24);xstring(0.1,0.6,'a'); //big alpha
xset('default')
Author :
J.Ph.C..
2.110 xstringb draw a matrix of strings
CALLING SEQUENCE :
xstringb(x,y,str,w,h,[option])
PARAMETERS :
- x,y,w,h
: real scalars (rectangle def)
- str
: matrix of strings
- option
: string
DESCRIPTION :
plots the matrix of strings str centred inside the rectangle rect=[x,y,w,h] (Down left point , width ,height) in the current graphic scale.
If option is given with the value "fill" the character size is computed
so as to fill as much as possible of the rectangle.
Enter the command xstringb() to see a demo.
EXAMPLE :
mat=['Scilab','is';'not','balicS'];
plot2d(0,0,[-1,1],'010',' ',[0,0,1,1]);
r=[0,0,1,0.5];
xstringb(r(1),r(2),mat,r(3),r(4),'fill');
xrect(r(1),r(2)+r(4),r(3),r(4))
r=[r(1),r(2)+r(4)+0.01,r(3),r(4)/2];
xrect(r(1),r(2)+r(4),r(3),r(4))
xstringb(r(1),r(2),mat,r(3),r(4),'fill');
r=[r(1),r(2)+r(4)+0.01,r(3),r(4)/2];
xrect(r(1),r(2)+r(4),r(3),r(4))
xstringb(r(1),r(2),mat,r(3),r(4),'fill');
See Also :
xtitle
X, titlepage
X, xstring
X, xstringl
X
Author :
J.Ph.C.
2.111 xstringl computes bounding box of the display of matrix of strings
CALLING SEQUENCE :
[rect]=xstringl(x,y,str)
PARAMETERS :
- x,y
: real scalars (point coordinates)
- str
: matrix of strings
- rect
: vector of 4 real scalars (rectangle def [x,y,w,h])
DESCRIPTION :
returns in rect=[x,y,w,h] ( upper-left point, width, height)
the size of a rectangle in the current graphic scale. which if drawn
would surround the string str drawn at location x,y.
REMARK :
The result can be approximative under the Postscript driver
EXAMPLE :
plot2d([0;1],[0;1])
rect=xstringl(0.5,0.5,["Scilab","is" ; "not","balicS"])
See Also :
xstring
X
Author :
J.Ph.C..
2.112 xtape set up the record process of graphics
CALLING SEQUENCE :
xtape(str,num)
PARAMETERS :
- str
: string ( 'on' or 'replay' or 'clear')
- num
: an integer
DESCRIPTION :
xtape is used to set up the record process of graphics
- xtape('on')
: just select the driver "Rec" which records all the
graphics operations.
- xtape('clear', num)
: clear the graphic window num and clear the recorded
graphics associated with window num.
- xtape('replay',xx)
: clear the window num and redisplay all the recorded
graphics in it ( used when a user changes the size of a graphic window
under xscilab).
Author :
J.Ph.C.
2.113 xtitle add titles on a graphic window
CALLING SEQUENCE :
[]=xtitle(xtit,[xax,yax,encad])
PARAMETERS :
- xtit, xax, yax
: matrices of strings (global and x,y titles)
- encad
: integer value (if = 1 a framed box is added around each title).
DESCRIPTION :
Add titles on a 2D or 3D Scilab plot. xtit stand for a general title
, xax for a title on the X-axis and yax for a title on the Y-axis.
This function must be called after
a call to the high level plotting function (plot2d,plot3d,...). If the
arguments are matrices each line of the matrices is displayed on a different
line.
Enter the command xtitle() to see a demo.
Author :
J.Ph.C.
2.114 zgrid zgrid plot
CALLING SEQUENCE :
zgrid()
DESCRIPTION :
plots z-plane grid lines: lines of constant
damping factor (zeta) and natural frequency (Wn) are
drawn in within the unit Z-plane circle.
Iso-frequency curves are shown in frequency*step on the
interval [0,0.5]. Upper limit corresponds to Shannon
frequency ( 1/dt > 2*f ).
See Also :
frep2tf
X, freson
X