afe08057429870f1d9fe9c6ea6d993928b99cff8
[scilab.git] / scilab / modules / graphics / help / en_US / axes_operations / replot.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <!--
4  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
5  * Copyright (C) ENPC - Jean-Philippe Chancelier
6  * Copyright (C) 2013 - Samuel GOUGEON
7  * 
8  * This file must be used under the terms of the CeCILL.
9  * This source file is licensed as described in the file COPYING, which
10  * you should have received as part of this distribution.  The terms
11  * are also available at    
12  * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
13  *
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="replot">
17     
18     <refnamediv>
19         
20         <refname>replot</refname>
21         
22         <refpurpose>redraw with new boundaries the current or a given set of axes
23             
24         </refpurpose>
25         
26     </refnamediv>
27     
28     <refsynopsisdiv>
29         
30         <title>Calling Sequence</title>
31         
32         <synopsis>replot(area)</synopsis>
33         
34         <synopsis>replot(area, axesHandles)</synopsis>
35         
36     </refsynopsisdiv>
37     
38     <refsection>
39         
40         <title>Arguments</title>
41         
42         <variablelist>
43             
44             <varlistentry>
45                 
46                 <term>area</term>
47                 
48                 <listitem>
49                     
50                     <para>row vector [xmin ymin xmax ymax] or [xmin ymin zmin xmax ymax zmax]: new bounds of the area to be replotted. 
51                         
52                         <note>
53                             Use <literal>%nan</literal> to keep a bound as is.
54                         </note>
55                         
56                     </para>
57                     
58                 </listitem>
59                 
60             </varlistentry>
61             
62             <varlistentry>
63                 
64                 <term>axeHandle</term>
65                 
66                 <listitem>
67                     
68                     <para>Vector of graphics handles of type Axes: Axes to crop. By default, the current Axes of the current figure is considered.
69                         
70                     </para>
71                     
72                 </listitem>
73                 
74             </varlistentry>
75             
76         </variablelist>
77         
78     </refsection>
79     
80     <refsection>
81         
82         <title>Description</title>
83         
84         <para>
85             
86             <literal>replot</literal> is used to redraw the content of the current graphics axes with new boundaries defined by
87             
88             <literal>area = [xmin,ymin, xmax,ymax]</literal> or <literal>area = [xmin,ymin,zmin, xmax,ymax,zmax]</literal>. 
89             
90         </para>
91         
92         <para>This transformation can be applied to specific
93             
94             axes given by Axes graphics handles via the <varname>axesHandles</varname> argument. If <varname>axesHandles</varname> is
95             
96             not specified, the new boundaries are applied to the current axes of the
97             
98             current figure. The transformation changes the <literal>data_bounds</literal>
99             
100             value of those axes.
101             
102         </para>
103         
104         <note>
105             The axes property <literal>tight_limits</literal>
106             
107             must be set to "on" to strictly select specified bounds (see
108             
109             <link linkend="axes_properties">axes_properties</link>)
110             
111         </note>
112         
113     </refsection>
114     
115     <refsection>
116         
117         <title>Examples</title>
118         
119         <programlisting role="example"><![CDATA[
120       x=[0:0.1:2*%pi]';
121       plot2d(x,sin(x))
122       replot([-1,-1,10,2])
123       ]]></programlisting>
124         
125         <scilab:image>
126             
127             x=[0:0.1:2*%pi]';
128             
129             plot2d(x,sin(x))
130             
131             replot([-1,-1,10,2])
132             
133         </scilab:image>
134         
135         
136         
137         <programlisting role="example"><![CDATA[
138       xdel(winsid());
139       plot() // plot demo
140       f=gcf();
141       replot([-1,-1,10,2],f.children(1)) // specify axes handle's value
142       replot([-3,-2,8,4],f.children(2))
143       ]]></programlisting>
144         
145         <scilab:image>
146             
147             xdel(winsid());
148             
149             plot()
150             
151             f2=gcf();
152             
153             replot([-1,-1,10,2],f2.children(1))
154             
155             replot([-3,-2,8,4],f2.children(2))
156             
157         </scilab:image>
158         
159         <programlisting role="example"><![CDATA[
160 // Leaving some bounds as is with %nan:
161 x = linspace(0,360,200).';
162 clf
163 plot2d(x,[sind(x) tand(x)])
164 ax = gca();
165 ax.data_bounds                          // initial bounds
166 replot([%nan,-10,%nan,10])      // only Ymin and Ymax are changed
167 ax.data_bounds                          // updated bounds
168
169 // Resizing Z bounds as well as X and Y ones in 3D view:
170 clf
171 x = linspace(-4,4,100);
172 X = meshgrid(x);
173 R = (X-0.5).^2 + (X.'+0.7).^2;
174 Z = sinc(R);
175 surf(x-0.5,x+0.7,Z)
176 f = gcf();
177 f.color_map = autumncolormap(100);
178 ax = gca();
179 ax.data_bounds
180 sleep(3000)
181 replot([-5 0 -0.4 0 5 0.5])
182 ax.data_bounds
183
184 // Resizing several chosen axes together:
185 clf
186 x = linspace(-%pi,%pi,400);
187 subplot(2,2,1)
188 plot2d(x,sin(1 ./sqrt(abs(x))))
189 ax1 = gca();
190 subplot(2,2,2)
191 plot2d(x,sinh(sqrt(abs(x))))
192 subplot(2,1,2)
193 plot2d(x,cos(1 ./sqrt(abs(x))))
194 ax2 = gca();
195 sleep(4000)
196 f = gcf();
197 replot([-1 %nan 1.5 %nan], [ax1 ax2])
198       ]]></programlisting>
199         
200         
201         
202     </refsection>
203     
204     <refsection role="see also">
205         
206         <title>See Also</title>
207         
208         <simplelist type="inline">
209             
210             <member>
211                 
212                 <link linkend="zoom_rect">zoom_rect</link>
213                 
214             </member>
215             
216             <member>
217                 
218                 <link linkend="rubberbox">rubberbox</link>
219                 
220             </member>
221             
222             <member>
223                 
224                 <link linkend="axes_properties">axes_properties</link>
225                 
226             </member>
227             
228         </simplelist>
229         
230     </refsection>
231     
232     <refsection>
233         
234         <title>History</title>
235         
236         <revhistory>
237             
238             <revision>
239                 
240                 <revnumber>5.5.0</revnumber>
241                 
242                 <revdescription>
243                     
244                     <itemizedlist>
245                         
246                         <listitem>Extension to 3D
247                             
248                         </listitem>
249                         
250                         <listitem>axesHandles vectorized
251                             
252                         </listitem>
253                         
254                         <listitem>
255                             <literal>%nan</literal> can be used to keep a bound as is.
256                             
257                         </listitem>
258                         
259                     </itemizedlist>
260                     
261                 </revdescription>
262                 
263             </revision>
264             
265         </revhistory>
266         
267     </refsection>
268     
269 </refentry>