4bd3cc45a6661d921cb11e68449f30fb58209ef5
[scilab.git] / scilab / modules / graphics / help / en_US / axes_operations / subplot.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) INRIA
5  * Copyright (C) 2012 - 2016 - Scilab Enterprises
6  * Copyright (C) 2019 - Samuel GOUGEON
7  *
8  * This file is hereby licensed under the terms of the GNU GPL v2.0,
9  * pursuant to article 5.3.4 of the CeCILL v.2.1.
10  * This file was originally licensed under the terms of the CeCILL v2.1,
11  * and continues to be available under such terms.
12  * For more information, see the COPYING file which you should have received
13  * along with this program.
14  *
15  -->
16 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
17           xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML"
18           xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
19           xml:lang="en" xml:id="subplot">
20     <refnamediv>
21         <refname>subplot</refname>
22         <refpurpose>sets the current axes to a chosen cell of the current gridded figure</refpurpose>
23     </refnamediv>
24     <refsynopsisdiv>
25         <title>Syntax</title>
26         <synopsis>
27             subplot(m,n,p)
28             subplot(mnp)
29         </synopsis>
30     </refsynopsisdiv>
31     <refsection>
32         <title>Arguments</title>
33         <variablelist>
34             <varlistentry>
35                 <term>m, n, p</term>
36                 <listitem>
37                     <para>positive integers</para>
38                 </listitem>
39             </varlistentry>
40             <varlistentry>
41                 <term>mnp</term>
42                 <listitem>
43                     <para>
44                         an integer with decimal notation <literal>mnp</literal>
45                     </para>
46                 </listitem>
47             </varlistentry>
48         </variablelist>
49     </refsection>
50     <refsection>
51         <title>Description</title>
52         <para>
53             subplot(m,n,p) or subplot(mnp) virtually grids the graphics window into an m-by-n
54             matrix of sub-windows, and selects the p<superscript>th</superscript> sub-window
55             for receiving the forthcoming drawings.
56         </para>
57         <para>
58             Into the grid, cells are indexed along each row, starting from the top row.
59             Hence, for instance the last cell of the first row is the p = n<superscript>th</superscript>
60             one. The cell on the row #i and the column #j has the index <literal>p=(i-1)*n+j</literal>.
61         </para>
62         <para>
63             When the selected area matches exactly an existing axes, <literal>subplot(…)</literal>
64             just sets it as the current axes, and returns.
65         </para>
66         <para>
67             Otherwise, <literal>subplot(…)</literal> creates an empty axes covering the selected area,
68             ready to receive forthcoming plotting contents.
69         </para>
70     </refsection>
71     <refsection>
72         <title>Examples</title>
73         <programlisting role="example"><![CDATA[
74             clf
75             subplot(221)
76             plot2d()
77
78             subplot(222)
79             plot3d()
80
81             subplot(2,2,3)
82             param3d()
83
84             subplot(2,2,4)
85             hist3d()
86  ]]></programlisting>
87         <scilab:image>
88             subplot(221)
89             plot2d()
90             subplot(222)
91             plot3d()
92             subplot(2,2,3)
93             param3d()
94             subplot(2,2,4)
95             hist3d()
96         </scilab:image>
97         <para/>
98         <para>
99             <emphasis role="bold">A more complex layout</emphasis>, but still gridable:
100         </para>
101         <programlisting role="example"><![CDATA[
102             clf
103             subplot(1,2,2)
104             Matplot1()
105             xtitle("Matplot1() example","","")
106
107             subplot(2,2,1)
108             histplot
109             delete(findobj("type","Legend"))
110
111             subplot(2,2,3)
112             title("Smaller plots:", "fontsize",3)
113
114             subplot(2,4,5)
115             polarplot()
116
117             subplot(2,4,6)
118             param3d()
119             xtitle("","","","")
120  ]]></programlisting>
121         <scilab:image>
122             clf
123             subplot(1,2,2)
124             Matplot1()
125             xtitle("Matplot1() example","","")
126
127             subplot(2,2,1)
128             histplot
129             delete(findobj("type","Legend"))
130
131             subplot(2,2,3)
132             title("Smaller plots:", "fontsize",3)
133
134             subplot(2,4,5)
135             polarplot()
136
137             subplot(2,4,6)
138             param3d()
139             xtitle("","","","")
140             gcf().axes_size = [670 400];
141         </scilab:image>
142     </refsection>
143     <refsection role="see also">
144         <title>See also</title>
145         <simplelist type="inline">
146             <member>
147                 <link linkend="xsetech">xsetech</link>
148             </member>
149             <member>
150                 <link linkend="newaxes">newaxes</link>
151             </member>
152             <member>
153                 <link linkend="axes_properties">axes_properties</link>
154             </member>
155             <member>
156                 <link linkend="plotframe">plotframe</link>
157             </member>
158         </simplelist>
159     </refsection>
160 </refentry>