Get rid of show_pixmap + add new sample images
[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 clf();
61 ax=gca();//get current axes handle
62 ax.data_bounds=[0,0;10,10];//set the data_bounds
63 ax.box='on'; //draw a box
64 a=5*ones(11,11);
65 a(2:10,2:10)=4;
66 a(5:7,5:7)=2;
67 // first matrix in rectangle [1,1,3,3]
68 Matplot1(a,[1,1,3,3])
69 a=ones(10,10);
70 a= 3*tril(a)+ 2*a;
71 // second matrix in rectangle [5,6,7,8]
72 Matplot1(a,[5,6,7,8])
73  ]]></programlisting>
74         <scilab:image>
75             ax=gca();//get current axes handle
76             ax.data_bounds=[0,0;10,10];//set the data_bounds
77             ax.box='on'; //draw a box
78             a=5*ones(11,11); a(2:10,2:10)=4; a(5:7,5:7)=2;
79             // first matrix in rectangle [1,1,3,3]
80             Matplot1(a,[1,1,3,3])
81             a=ones(10,10); a= 3*tril(a)+ 2*a;
82             // second matrix in rectangle [5,6,7,8]
83             Matplot1(a,[5,6,7,8])
84         </scilab:image>
85         <programlisting role="example"><![CDATA[ 
86 //--- (animation)
87 n=100;
88
89 clf();
90 f=gcf();//get current figure handle
91 f.pixmap='on';//double buffer mode
92 ax=gca();//get current axes handle
93 ax.data_bounds=[0,0;10,10];//set the data_bounds
94 ax.box='on'; //draw a box
95 for k=-n:n,
96   a=ones(n,n);
97   a= 3*tril(a,k)+ 2*a;
98   a= a + a';
99   k1= 3*(k+100)/200;
100   if k>-n then delete(gce()),end
101   Matplot1(a,[k1,2,k1+7,9])
102   sleep(8); // Slow down the simulation
103 end
104 f.pixmap='off';
105  ]]></programlisting>
106     </refsection>
107     <refsection role="see also">
108         <title>See Also</title>
109         <simplelist type="inline">
110             <member>
111                 <link linkend="colormap">colormap</link>
112             </member>
113             <member>
114                 <link linkend="plot2d">plot2d</link>
115             </member>
116             <member>
117                 <link linkend="Matplot">Matplot</link>
118             </member>
119             <member>
120                 <link linkend="grayplot">grayplot</link>
121             </member>
122             <member>
123                 <link linkend="Matplot_properties">Matplot_properties</link>
124             </member>
125         </simplelist>
126     </refsection>
127 </refentry>