Add sleep(20) instead sleep(8) in animation of matplot1 help.
[scilab.git] / scilab / modules / graphics / help / en_US / 2d_plot / Matplot1.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4  * Copyright (C) ENPC - Jean-Philippe Chancelier
5  * 
6  * This file must be used under the terms of the CeCILL.
7  * This source file is licensed as described in the file COPYING, which
8  * you should have received as part of this distribution.  The terms
9  * are also available at    
10  * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
11  *
12  -->
13 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"  xml:lang="en" xml:id="Matplot1">
14     <refnamediv>
15         <refname>Matplot1</refname>
16         <refpurpose>
17             2D plot of a matrix using colors
18         </refpurpose>
19     </refnamediv>
20     <refsynopsisdiv>
21         <title>Calling Sequence</title>
22         <synopsis>Matplot1(a, rect)</synopsis>
23     </refsynopsisdiv>
24     <refsection>
25         <title>Arguments</title>
26         <variablelist>
27             <varlistentry>
28                 <term>a</term>
29                 <listitem>
30                     <para>
31                         a real matrix of size <literal>(n1,n2)</literal>.
32                     </para>
33                 </listitem>
34             </varlistentry>
35             <varlistentry>
36                 <term>rect</term>
37                 <listitem>
38                     <para>
39                         <literal>[xmin, ymin, xmax, ymax]</literal>.
40                     </para>
41                 </listitem>
42             </varlistentry>
43         </variablelist>
44     </refsection>
45     <refsection>
46         <title>Description</title>
47         <para>
48             The entries of matrix <code>int(a)</code> are used as colormap entries
49             in the current colormap.  <varname>rect</varname> specifies a rectangle in the
50             current scale and the matrix is drawn inside this rectangle. Each matrix
51             entry will be rendered as a small rectangle filled with its associated
52             color. If a matrix entry is outside the colormap, the corresponding rectangle
53             is not displayed.
54         </para>
55         <para>
56             Enter the command <code>Matplot1()</code> to see a demo.
57         </para>
58     </refsection>
59     <refsection>
60         <title>Examples</title>
61         <programlisting role="example"><![CDATA[ 
62 clf();
63 ax = gca();//get current axes handle
64 ax.data_bounds = [0, 0; 10, 10]; //set the data_bounds
65 ax.box = 'on'; //draw a box
66 a = 5*ones(11,11);
67 a(2:10, 2:10) = 4;
68 a(5:7, 5:7) = 2;
69 // first matrix in rectangle [1,1,3,3]
70 Matplot1(a, [1,1,3,3])
71 a = ones(10,10);
72 a = 3*tril(a)+ 2*a;
73 // second matrix in rectangle [5,6,7,8]
74 Matplot1(a,[5,6,7,8])
75  ]]></programlisting>
76         <scilab:image>
77             ax=gca();//get current axes handle
78             ax.data_bounds=[0,0;10,10];//set the data_bounds
79             ax.box='on'; //draw a box
80             a=5*ones(11,11); a(2:10,2:10)=4; a(5:7,5:7)=2;
81             // first matrix in rectangle [1,1,3,3]
82             Matplot1(a,[1,1,3,3])
83             a=ones(10,10); a= 3*tril(a)+ 2*a;
84             // second matrix in rectangle [5,6,7,8]
85             Matplot1(a,[5,6,7,8])
86         </scilab:image>
87         <programlisting role="example"><![CDATA[ 
88 //--- (animation)
89 n=100;
90
91 clf();
92 f=gcf();//get current figure handle
93 f.pixmap='on';//double buffer modea
94 ax=gca();//get current axes handle
95 ax.data_bounds=[0,0;10,10];//set the data_bounds
96 ax.box='on'; //draw a box
97 for k=-n:n,
98   a=ones(n,n);
99   a= 3*tril(a,k)+ 2*a;
100   a= a + a';
101   k1= 3*(k+100)/200;
102   if k>-n then delete(gce()),end
103   Matplot1(a,[k1,2,k1+7,9])
104   sleep(20); // Slow down the simulation
105 end
106 f.pixmap='off';
107  ]]></programlisting>
108     </refsection>
109     <refsection role="see also">
110         <title>See Also</title>
111         <simplelist type="inline">
112             <member>
113                 <link linkend="colormap">colormap</link>
114             </member>
115             <member>
116                 <link linkend="plot2d">plot2d</link>
117             </member>
118             <member>
119                 <link linkend="Matplot">Matplot</link>
120             </member>
121             <member>
122                 <link linkend="grayplot">grayplot</link>
123             </member>
124             <member>
125                 <link linkend="Matplot_properties">Matplot_properties</link>
126             </member>
127         </simplelist>
128     </refsection>
129 </refentry>