contour — level curves on a 3D surface
contour(x,y,z,nz,[theta,alpha,leg,flag,ebox,zlev]) contour(x,y,z,nz,<opt_args>)
two real row vectors of size n1 and n2.
real matrix of size (n1,n2), the values of the function or a
Scilab function which defines the surface z=f(x,y)
.
the level values or the number of levels.
If nz
is an integer, its value gives the number of
level curves equally spaced from zmin to zmax as follows:
z= zmin + (1:nz)*(zmax-zmin)/(nz+1)
Note that the zmin
and
zmax
levels are not drawn (generically
they are reduced to points) but they can be added
with
[im,jm] = find(z == zmin); // or zmax plot2d(x(im)',y(jm)',-9,"000")
If nz
is a vector,
nz(i)
gives the value of the ith level
curve. Note that it can be useful in order to see
zmin
and zmax
level curves
to add an epsilon tolerance: nz=[zmin+%eps,..,zmax-%eps]
.
a sequence of statements key1=value1, key2=value2
,
... where keys may be
theta
,alpha
,leg
,flag
, ebox
,zlev
(see below). In
this case, the order has no special meaning.
real values giving in degree the spherical coordinates of the observation point.
string defining the captions for each axis with @ as a field separator, for example "X@Y@Z".
a real vector of size three flag=[mode,type,box]
.
string representation mode.
the level curves are drawn on the surface defined by (x,y,z).
the level curves are drawn on a 3D plot and on the plan defined by the equation z=zlev.
the level curves are drawn on a 2D plot.
an integer (scaling).
the plot is made using the current 3D scaling (set by
a previous call to param3d
,
plot3d
, contour
or
plot3d1
).
rescales automatically 3d boxes with extreme aspect
ratios, the boundaries are specified by the value of
the optional argument ebox
.
rescales automatically 3d boxes with extreme aspect ratios, the boundaries are computed using the given data.
3d isometric with box bounds given by optional
ebox
, similarily to
type=1
3d isometric bounds derived from the data, to
similarilytype=2
3d expanded isometric bounds with box bounds given
by optional ebox
, similarily to
type=1
3d expanded isometric bounds derived from the data,
similarily to type=2
an integer (frame around the plot).
nothing is drawn around the plot.
unimplemented (like box=0).
only the axes behind the surface are drawn.
a box surrounding the surface is drawn and captions are added.
a box surrounding the surface is drawn, captions and axes are added.
used when type
in flag
is 1. It
specifies the boundaries of the plot as the vector
[xmin,xmax,ymin,ymax,zmin,zmax]
.
real number.
contour
draws level curves of a surface z=f(x,y). The level curves are
drawn on a 3D surface. The optional arguments are the same as for the function
plot3d
(except zlev
) and their meanings are the same.
They control the drawing of level curves on a 3D plot.
Only flag(1)=mode
has a special meaning.
the level curves are drawn on the surface defined by (x,y,z).
the level curves are drawn on a 3D plot and on the plan defined by the equation z=zlev.
the level curves are drawn on a 2D plot.
You can change the format of the floating point number printed on the levels
by using xset("fpf",string)
where string
gives the
format in C format syntax (for example string="%.3f"
). Use
string=""
to switch back to default format and Use
string=" "
to suppress printing.
Usually we use contour2d
to draw levels curves on a 2D plot.
Enter the command contour()
to see a demo.
t=linspace(-%pi,%pi,30); function z=my_surface(x,y),z=x*sin(x)^2*cos(y),endfunction contour(t,t,my_surface,10) // changing the format of the printing of the levels xset("fpf","%.1f") clf() contour(t,t,my_surface,10) // 3D clf() z=feval(t,t,my_surface); plot3d(t,t,z);contour(t,t,z+0.2*abs(z),20,flag=[0 2 4]);