9917764cc140816c6bf9cf04ed4c355ddfa1effb
[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" version="5.0-subset Scilab" xml:lang="en" xml:id="Matplot1">
14     <refnamediv>
15         <refname>Matplot1</refname>
16         <refpurpose>2D plot of a matrix using
17             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>real matrix of size (n1,n2).</para>
31                 </listitem>
32             </varlistentry>
33             <varlistentry>
34                 <term>rect</term>
35                 <listitem>
36                     <para>
37                         <literal>[xmin,ymin,xmax,ymax]</literal>
38                     </para>
39                 </listitem>
40             </varlistentry>
41         </variablelist>
42     </refsection>
43     <refsection>
44         <title>Description</title>
45         <para>
46             The entries of matrix <literal>int(a)</literal> are used as colormap entries
47             in the current colormap.  <literal>rect</literal> specify a rectangle in the
48             current scale and the matrix is drawn inside this rectangle. Each matrix
49             entry will be rendered as a small rectangle filled with its associated
50             color. If a matrix entry is outside the colormap, the corresponding rectangle is not displayed.
51         </para>
52     </refsection>
53     <refsection>
54         <title>Sample</title>
55         <scilab:image>Matplot1();</scilab:image>
56     </refsection>
57     <refsection>
58         <title>Examples</title>
59         <programlisting role="example"><![CDATA[ 
60 //--- first example
61 clf();
62 ax=gca();//get current axes handle
63 ax.data_bounds=[0,0;10,10];//set the data_bounds
64 ax.box='on'; //draw a box 
65 a=5*ones(11,11); a(2:10,2:10)=4; a(5:7,5:7)=2;
66 // first matrix in rectangle [1,1,3,3]
67 Matplot1(a,[1,1,3,3])
68 a=ones(10,10); a= 3*tril(a)+ 2*a; 
69 // second matrix in rectangle [5,6,7,8]
70 Matplot1(a,[5,6,7,8])
71
72 //--- second example  (animation)
73 n=100;
74
75 clf();
76 f=gcf();//get current figure handle
77 f.pixmap='on';//double buffer mode
78 ax=gca();//get current axes handle
79 ax.data_bounds=[0,0;10,10];//set the data_bounds
80 ax.box='on'; //draw a box 
81 show_pixmap()
82 for k=-n:n,
83   a=ones(n,n);
84   a= 3*tril(a,k)+ 2*a;
85   a= a + a';
86   k1= 3*(k+100)/200;
87   if k>-n then delete(gce()),end
88   Matplot1(a,[k1,2,k1+7,9])
89   show_pixmap() //send double buffer to screen
90   sleep(8); // Slow down the simulation
91 end
92 f.pixmap='off';
93  ]]></programlisting>
94     </refsection>
95     <refsection role="see also">
96         <title>See Also</title>
97         <simplelist type="inline">
98             <member>
99                 <link linkend="colormap">colormap</link>
100             </member>
101             <member>
102                 <link linkend="plot2d">plot2d</link>
103             </member>
104             <member>
105                 <link linkend="Matplot">Matplot</link>
106             </member>
107             <member>
108                 <link linkend="grayplot">grayplot</link>
109             </member>
110             <member>
111                 <link linkend="Matplot_properties">Matplot_properties</link>
112             </member>
113         </simplelist>
114     </refsection>
115 </refentry>