<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
<MAN>
  <LANGUAGE>eng</LANGUAGE>

  <TITLE>Sfgrayplot</TITLE>

  <TYPE>Scilab Function</TYPE>

  <DATE>April 1993, revised Feb 2005</DATE>

  <SHORT_DESCRIPTION name="Sfgrayplot">smooth 2D plot of a surface defined by a function using colors
  </SHORT_DESCRIPTION>

  <CALLING_SEQUENCE>
    <CALLING_SEQUENCE_ITEM>Sfgrayplot(x,y,f,&lt;opt_args&gt;)</CALLING_SEQUENCE_ITEM>
    <CALLING_SEQUENCE_ITEM>Sfgrayplot(x,y,f [,strf, rect, nax, zminmax, colminmax, mesh, colout])</CALLING_SEQUENCE_ITEM>
  </CALLING_SEQUENCE>

  <PARAM>
    <PARAM_INDENT>
      <PARAM_ITEM>
        <PARAM_NAME>x,y</PARAM_NAME>

        <PARAM_DESCRIPTION>
          <SP>: real row vectors of size n1 and n2.</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>

      <PARAM_ITEM>
        <PARAM_NAME>f</PARAM_NAME>

        <PARAM_DESCRIPTION>
          <SP>: scilab function (z=f(x,y))</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>

      <PARAM_ITEM>
        <PARAM_NAME>&lt;opt_args&gt;</PARAM_NAME>

        <PARAM_DESCRIPTION>
          <SP>: This represents a sequence of statements <VERB>key1=value1,
          key2=value2</VERB>,... where <VERB>key1</VERB>,
          <VERB>key2,...</VERB> can be one of the following: strf, rect, nax, zminmax, colminmax, mesh, colout
          (see <LINK>plot2d</LINK> for the 3 first and <LINK>fec</LINK> for the 4 last).</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>

      <PARAM_ITEM>
        <PARAM_NAME>strf,rect,nax</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: see <LINK>plot2d</LINK>.</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>

      <PARAM_ITEM>
        <PARAM_NAME>zminmax, colminmax, mesh, colout</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: see <LINK>fec</LINK>.</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
  </PARAM_INDENT>
  </PARAM>


  <DESCRIPTION>
    <P><VERB>Sfgrayplot</VERB> is the same as <VERB>fgrayplot</VERB> but the
    plot is smoothed. The function <VERB>fec</VERB> 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):</P>
    <VERBATIM>
             _____________
             | /| /| /| /|
             |/_|/_|/_|/_| 
             | /| /| /| /| 
             |/_|/_|/_|/_|</VERBATIM>

    <P>The function <LINK>colorbar</LINK> may be used to see the color scale (but
       you must know (or compute) the min and max values).</P>

    <P>Instead of Sfgrayplot, you can use <LINK>Sgrayplot</LINK> and this may be
       a little faster.</P>  

    <P>Enter the command <VERB>Sfgrayplot()</VERB> to see a demo.</P>
  </DESCRIPTION>
<EXAMPLE><![CDATA[
// example #1: plot 4 surfaces
function z=surf1(x,y), z=x*y, endfunction
function z=surf2(x,y), z=x^2-y^2, endfunction
function z=surf3(x,y), z=x^3+y^2, endfunction
function z=surf4(x,y), z=x^2+y^2, endfunction
xbasc()
xset("colormap",[jetcolormap(64);hotcolormap(64)])
ng = get("figure_style") == "new";
x = linspace(-1,1,60);
y = linspace(-1,1,60);
if ng then, drawlater(), end
subplot(2,2,1)
   colorbar(-1,1,[1,64])
   Sfgrayplot(x,y,surf1,strf="041",colminmax=[1,64])
   xtitle("f(x,y) = x*y")
subplot(2,2,2)
   colorbar(-1,1,[65,128])
   Sfgrayplot(x,y,surf2,strf="041",colminmax=[65,128])
   xtitle("f(x,y) = x^2-y^2")
subplot(2,2,3)
   colorbar(-1,2,[65,128])
   Sfgrayplot(x,y,surf3,strf="041",colminmax=[65,128])
   xtitle("f(x,y) = x^3+y^2")
subplot(2,2,4)
   colorbar(0,2,[1,64])
   Sfgrayplot(x,y,surf4,strf="041",colminmax=[1,64])
   xtitle("f(x,y) = x^2+y^2")
if ng then, drawnow(), end
xselect()

// example #2: plot surf3 and add some contour lines 
function z=surf3(x,y), z=x^3+y^2, endfunction
xbasc()
x = linspace(-1,1,60);
y = linspace(-1,1,60);
xset("colormap",hotcolormap(128))
ng = get("figure_style") == "new";
if ng then, drawlater(), end
colorbar(-1,2)
Sfgrayplot(x,y,surf3,strf="041")
z = (x')^3*ones(y) + ones(x')*y^2;
fcontour2d(x,y,surf3,[-0.1, 0.025, 0.4],style=[1 1 1],strf="000")
xtitle("f(x,y) = x^3+y^2")
if ng then, drawnow(), end
xselect()

// example #3: plot surf3 and use zminmax and colout optional arguments
//             to restrict the plot for -0.5<= z <= 1
function z=surf3(x,y), z=x^3+y^2, endfunction
xbasc()
x = linspace(-1,1,60);
y = linspace(-1,1,60);
xset("colormap",jetcolormap(128))
ng = get("figure_style") == "new";
if ng then, drawlater(), end
zminmax = [-0.5 1]; colors=[32 96];
colorbar(zminmax(1),zminmax(2),colors)
Sfgrayplot(x, y, surf3, strf="041", zminmax=zminmax, colout=[0 0], colminmax=colors)
z = (x')^3*ones(y) + ones(x')*y^2;
fcontour2d(x,y,surf3,[-0.5, 1],style=[1 1 1],strf="000")
xtitle("f(x,y) = x^3+y^2, with parts under z = -0.5 and upper z = 1 removed")
if ng then, drawnow(), end
xselect()
 ]]>
  </EXAMPLE>
  <SEE_ALSO>
    <SEE_ALSO_ITEM>
      <LINK>fec</LINK>
    </SEE_ALSO_ITEM>
    <SEE_ALSO_ITEM>
      <LINK>fgrayplot</LINK>
    </SEE_ALSO_ITEM>
    <SEE_ALSO_ITEM>
      <LINK>grayplot</LINK>
    </SEE_ALSO_ITEM>
    <SEE_ALSO_ITEM>
      <LINK>Sgrayplot</LINK>
    </SEE_ALSO_ITEM>
  </SEE_ALSO>
  <AUTHOR>J.Ph.C.  </AUTHOR>
</MAN>
