Sgrayplot — smooth 2D plot of a surface using colors
Sgrayplot(x,y,z,<opt_args>) Sgrayplot(x,y,z [,strf, rect, nax, zminmax, colminmax, mesh, colout])
real row vectors of size n1 and n2.
real matrix of size (n1,n2). z(i,j)
is the value
of the surface at the point (x(i),y(j)).
This represents a sequence of statements
key1=value1,key2=value2
,... where key1
,
key2,...
can be one of the following: strf, rect, nax, zminmax, colminmax, mesh, colout.
is a string of length 3 "xyz"
(by default
strf= "081"
)
controls the display of captions.
no caption.
captions are displayed. They are given by the
optional argument leg
.
controls the computation of the actual coordinate ranges from the minimal requested values. Actual ranges can be larger than minimal requirements.
no computation, the plot use the previus (or default) scale
from the rect arg
from the min/max of the x, y datas
built for an isometric scale from the rect arg
built for an isometric plot from the min/max of the x, y datas
enlarged for pretty axes from the rect arg
enlarged for pretty axes from the min/max of the x, y datas
like y=1 but the previus plot(s) are redrawn to use the new scale
like y=2 but the previus plot(s) are redrawn to use the new scale
controls the display of information on the frame around
the plot. If axes are requested, the number of tics can be
specified by the nax
optional argument.
nothing is drawn around the plot.
axes are drawn, the y=axis is displayed on the left.
the plot is surrounded by a box without tics.
axes are drawn, the y=axis is displayed on the right.
axes are drawn centred in the middle of the frame box, with the box disabled.
axes are drawn centred in the middle of the frame box, with the box enabled.
This argument is used when the second character y of argument
strf
is 1, 3 or 5. It is a row vector of size 4 and
gives the dimension of the frame:
rect=[xmin,ymin,xmax,ymax]
.
This argument is used when the third character z of argument
strf
is 1. It is a row vector with four entries
[nx,Nx,ny,Ny]
where nx
(ny
)
is the number of subgraduations on the x (y) axis and
Nx
(Ny
) is the number of graduations on
the x (y) axis.
See fec.
Sgrayplot
is the same as grayplot
but the
plot is smoothed. The function fec
is used for smoothing. The
surface is plotted assuming that it is linear on a set of triangles built
from the grid (here with n1=5, n2=3):
_____________ | /| /| /| /| |/_|/_|/_|/_| | /| /| /| /| |/_|/_|/_|/_|
The function colorbar may be used to see the color scale.
The parameter zminmax
is useful for animation purpose (see an
example after) and the parameter colminmax
lets the user choose a part
of the current colormap (see the fec help page).
Enter the command Sgrayplot()
to see a demo.
// example #1 x=-10:10; y=-10:10;m =rand(21,21); clf() xset("colormap",hotcolormap(64)) Sgrayplot(x,y,m, strf="011", rect=[-20,-20,20,20]) // example #2 t=-%pi:0.1:%pi; m=sin(t)'*cos(t); clf() xset("colormap",jetcolormap(64)) colorbar(-1,1) Sgrayplot(t,t,m, strf="041") // example #3: an animation display cos(t)*sin(x)sin(y). n = 30; nt = 100; x = linspace(0,2*%pi,n); y = linspace(0,%pi,n/2); z = sin(x')*sin(y); t = linspace(0,4*%pi,nt); xselect(); clf() f=gcf(); f.color_map=jetcolormap(64); f.pixmap='on'; colorbar(-1,1) Sgrayplot(x,y,cos(t(1))*z, strf="042", zminmax=[-1,1]) c=gce(),e=c.children xtitle("Kaa''s eyes") for i = 1:nt e.data(:,3)=matrix(cos(t(i))*z,-1,1); show_pixmap() end f.pixmap='off';