0a1a85ea8398dd940be8868804cc8000e5d59c75
[scilab.git] / scilab / modules / graphics / help / en_US / axes_operations / newaxes.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 - Serge Steer
5  *
6  * Copyright (C) 2012 - 2016 - Scilab Enterprises
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" 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="newaxes">
17     <refnamediv>
18         <refname>newaxes</refname>
19         <refpurpose>Creates a new Axes entity</refpurpose>
20     </refnamediv>
21     <refsynopsisdiv>
22         <title>Syntax</title>
23         <synopsis>
24             a = newaxes()
25             a = newaxes(h)
26         </synopsis>
27     </refsynopsisdiv>
28     <refsection>
29         <title>Arguments</title>
30         <variablelist>
31             <varlistentry>
32                 <term>h</term>
33                 <listitem>
34                   <para>
35                     Optional handle of the graphic parent of the new axes,
36                     of type <literal>Figure</literal> or
37                     <literal>Uicontrol</literal> of style <literal>Frame</literal>.
38                     By default, the current figure is used.
39                   </para>
40                 </listitem>
41             </varlistentry>
42             <varlistentry>
43                 <term>a</term>
44                 <listitem>
45                     <para>Handle on the newly created Axes entity</para>
46                 </listitem>
47             </varlistentry>
48         </variablelist>
49     </refsection>
50     <refsection>
51         <title>Description</title>
52         <para>
53             <literal>newaxes()</literal> is used to create a new <literal>Axes</literal> entity (see
54             <link linkend="graphics_entities">graphics_entities</link>) in the current figure or in
55             the given figure or uicontrol frame.
56         </para>
57         <para>
58             The properties of this entity are inherited from the <literal>default_axes</literal>
59             entity (see <link linkend="gda">gda</link>)
60         </para>
61         <para>
62             <literal>newaxes(h)</literal> creates the axes in the frame
63             <link linkend="uicontrol">uicontrol</link> or figure whose handle is <literal>h</literal>.
64         </para>
65     </refsection>
66     <refsection>
67         <title>Examples</title>
68         <programlisting role="example"><![CDATA[
69 clf()
70 a1 = newaxes();
71 a1.axes_bounds = [0,0,1.0,0.5];
72 t = 0:0.1:20;
73 plot(t,acosh(t),'r')
74 a2 = newaxes();
75 a2.axes_bounds = [0,0.5,1.0,0.5];
76 x = 0:0.1:4;
77 plot(x,sinh(x))
78 legend('sinh')
79
80 sca(a1); //make first axes current
81 plot(t, asinh(t), 'g')
82 legend(['acosh','asinh'])
83  ]]></programlisting>
84         <para>
85             The following example uses <literal>newaxes(h)</literal>
86         </para>
87         <programlisting role="example"><![CDATA[
88 // Create a new figure
89 f = figure("layout", "gridbag", ...
90     "toolbar", "none", ...
91     "menubar", "none", ...
92     "backgroundcolor", [1 1 1]);
93
94 // Create the frames where each graph is put
95 c = createConstraints("gridbag", [1 1 1 1], [1 1], "both");
96 top_left = uicontrol(f, "style", "frame","constraints", c);
97
98 c.grid = [2 1 1 1];
99 top_right = uicontrol(f, "style", "frame", "constraints", c);
100
101 c.grid = [1 2 2 2];
102 bottom = uicontrol(f, "style", "frame", "constraints", c);
103
104 // Create the axes in each frame
105 a_tl = newaxes(top_left);
106 a_tr = newaxes(top_right);
107 a_bt = newaxes(bottom);
108
109 // Plot in the frames
110 X = (1:100) ./ 50;
111 plot(a_tl, X, X, "r");
112 plot(a_tr, X, cos(2 * %pi * 3 * X), "g");
113 plot(a_bt, X, exp(X), "b");
114
115 title(a_tl, "a line");
116 title(a_tr, "a cosine");
117 title(a_bt, "the exponential");
118     ]]></programlisting>
119     </refsection>
120     <refsection role="see also">
121         <title>See also</title>
122         <simplelist type="inline">
123             <member>
124                 <link linkend="subplot">subplot</link>
125             </member>
126             <member>
127                 <link linkend="xsetech">xsetech</link>
128             </member>
129             <member>
130                 <link linkend="gda">gda</link>
131             </member>
132             <member>
133                 <link linkend="sca">sca</link>
134             </member>
135         </simplelist>
136     </refsection>
137     <refsection role="history">
138         <title>History</title>
139         <revhistory>
140             <revision>
141                 <revnumber>5.5.0</revnumber>
142                 <revdescription>newaxes(h) can target a uicontrol frame or a given figure.
143                 </revdescription>
144             </revision>
145         </revhistory>
146     </refsection>
147 </refentry>