Scilab Function
Last update : 14/2/2006

Sgrayplot - smooth 2D plot of a surface using colors

Calling Sequence

Sgrayplot(x,y,z,<opt_args>)
Sgrayplot(x,y,z [,strf, rect, nax, zminmax, colminmax, mesh, colout])

Parameters

Description

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.

Examples

// 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).
// (Remark: this animation uses the old mode)
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';
  

See Also

fec ,   fgrayplot ,   grayplot ,   Sfgrayplot ,   colorbar ,  

Author

J.Ph.C.