1
plot3d Scilab Group Scilab Function plot3d
3
plot3d - 3D plot of a surface
6
plot3d(x,y,z,[theta,alpha,leg,flag,ebox])
7
plot3d(x,y,z,<opt_args>)
9
plot3d(xf,yf,zf,[theta,alpha,leg,flag,ebox])
10
plot3d(xf,yf,zf,<opt_args>)
12
plot3d(xf,yf,list(zf,colors),[theta,alpha,leg,flag,ebox])
13
plot3d(xf,yf,list(zf,colors),<opt_args>)
15
x,y : row vectors of sizes n1 and n2 (x-axis and y-axis
16
coordinates). These coordinates must be monotone.
18
z : matrix of size (n1,n2). z(i,j) is the value of the
19
surface at the point (x(i),y(j)).
21
xf,yf,zf : matrices of size (nf,n). They define the facets used to
22
draw the surface. There are n facets. Each facet i is
23
defined by a polygon with nf points. The x-axis, y-axis and
24
z-axis coordinates of the points of the ith facet are given
25
respectively by xf(:,i), yf(:,i) and zf(:,i).
27
colors : a vector of size n giving the color of each facets or a
28
matrix of size (nf,n) giving color near each facet boundary
29
(facet color is interpolated )
31
<opt_args> : This represents a sequence of statements key1=value1,
32
key2=value2,... where key1, key2,... can be one of the
33
following: theta, alpha ,leg,flag,ebox (see definition
36
theta, alpha : real values giving in degree the spherical coordinates of
37
the observation point.
39
leg : string defining the captions for each axis with @ as a
40
field separator, for example "X@Y@Z".
42
flag : a real vector of size three flag=[mode,type,box].
44
mode : string (treatment of hidden parts).
47
the hidden parts of the surface are removed and the
48
surface is painted with color mode.
51
the hidden parts of the surface are drawn.
54
only the shadow of the surface is painted with color or
55
pattern id -mode. Use xset() to see the meaning of
58
type : an integer (scaling).
60
type=0 the plot is made using the current 3D scaling
61
(set by a previous call to param3d, plot3d,
64
type=1 rescales automatically 3d boxes with extreme
65
aspect ratios, the boundaries are specified by
66
the value of the optional argument ebox.
68
type=2 rescales automatically 3d boxes with extreme
69
aspect ratios, the boundaries are computed
72
type=3 3d isometric with box bounds given by optional
73
ebox, similarily to type=1
75
type=4 3d isometric bounds derived from the data, to
78
type=5 3d expanded isometric bounds with box bounds
79
given by optional ebox, similarily to type=1
81
type=6 3d expanded isometric bounds derived from the
82
data, similarily to type=2
84
box : an integer (frame around the plot).
87
nothing is drawn around the plot.
90
unimplemented (like box=0).
93
only the axes behind the surface are drawn.
96
a box surrounding the surface is drawn and captions are
100
a box surrounding the surface is drawn, captions and
103
ebox : used when type in flag is 1. It specifies the boundaries
104
of the plot as the vector [xmin,xmax,ymin,ymax,zmin,zmax].
107
plot3d(x,y,z,[theta,alpha,leg,flag,ebox]) draws the surface z=f(x,y).
109
plot3d(xf,yf,zf,[theta,alpha,leg ,flag,ebox]) draws a surface defined by
110
a set of facets. You can draw multiple plots by replacing xf, yf and zf
111
by multiple matrices assembled by rows as [xf1 xf2 ...], [yf1 yf2 ...]
114
You can give a specific color for each facet by using list(zf,colors)
115
instead of zf, where colors is a vector of size n. If colors(i) is
116
positive it gives the color of facet i and the boundary of the facet is
117
drawn with current line style and color. If colors(i) is negative, color
118
id -colors(i) is used and the boundary of the facet is not drawn. Use
119
xset() to see the ids of the colors.
121
It is also possible to get interpolated color for facets. For that the
122
color argument must be a matrix of size nfxn giving the color near each
123
boundary of each facets. In this case positive values for colors mean
124
that the boundary are not drawn.
126
The optional arguments theta,alpha,leg ,flag,ebox, can be passed by a
127
sequence of statements key1=value1, key2=value2, ... In this case, the
128
order has no special meaning.
130
You can use the function genfac3d to compute four sided facets from the
131
surface z=f(x,y). eval3dp can also be used. Enter the command plot3d()
135
// simple plot using z=f(x,y)
136
t=[0:0.3:2*%pi]'; z=sin(t)*cos(t');
138
// same plot using facets computed by genfac3d
139
[xx,yy,zz]=genfac3d(t,t,z);
144
plot3d([xx xx],[yy yy],[zz 4+zz])
145
// multiple plots using colors
147
plot3d([xx xx],[yy yy],list([zz zz+4],[4*ones(1,400) 5*ones(1,400)]))
148
// simple plot with viewpoint and captions
150
plot3d(1:10,1:20,10*rand(10,20),35,45,"X@Y@Z",[2,2,3])
151
// plot of a sphere using facets computed by eval3dp
152
deff("[x,y,z]=sph(alp,tet)",["x=r*cos(alp).*cos(tet)+orig(1)*ones(tet)";..
153
"y=r*cos(alp).*sin(tet)+orig(2)*ones(tet)";..
154
"z=r*sin(alp)+orig(3)*ones(tet)"]);
156
[xx,yy,zz]=eval3dp(sph,linspace(-%pi/2,%pi/2,40),linspace(0,%pi*2,20));
157
xbasc();plot3d(xx,yy,zz)
159
xbasc();xset('colormap',hotcolormap(128));
160
r=0.3;orig=[1.5 0 0];
161
[xx1,yy1,zz1]=eval3dp(sph,linspace(-%pi/2,%pi/2,40),linspace(0,%pi*2,20));
162
cc=(xx+zz+2)*32;cc1=(xx1-orig(1)+zz1/r+2)*32;
163
xbasc();plot3d1([xx xx1],[yy yy1],list([zz,zz1],[cc cc1]),70,80)
165
xbasc();plot3d1([xx xx1],[yy yy1],list([zz,zz1],[cc cc1]),theta=70,alpha=80,flag=[5,6,3])
167
eval3dp, genfac3d, geom3d, param3d, plot3d1, xset