694aa933d4d320760b537c3a259486fb464c64ff
[scilab.git] / scilab / modules / graphics / help / en_US / figure_operations / figure_properties.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 - Djalel Abdemouche
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"
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="figure_properties">
20     <refnamediv>
21         <refname>figure properties</refname>
22         <refpurpose>description of the graphics
23             figure entity properties
24         </refpurpose>
25     </refnamediv>
26     <refsection>
27         <title>Description</title>
28         <para>The figure entity is the top level of the graphics entities hierarchy.
29             This entity contain a number of properties designed to control many
30             aspects of displaying Scilab graphics objects. These properties fall into
31             two categories. Properties that contain information about figure itself
32             and others related to set default values for the children creation.
33         </para>
34         <variablelist>
35             <varlistentry>
36                 <term>Figure properties: </term>
37                 <listitem>
38                     <variablelist>
39                         <varlistentry>
40                             <term>children: </term>
41                             <listitem>
42                                 <para>This handles represent the vector of the figure's children .
43                                     Note that all figure children are of type <literal>"Axes"</literal>.
44                                     Also keep in mind that, when creating a figure entity (using
45                                     <link linkend="scf">scf</link> command), an <literal>Axes</literal> entity is
46                                     simultaneously built too.
47                                 </para>
48                             </listitem>
49                         </varlistentry>
50                         <varlistentry>
51                             <term>figure_position: </term>
52                             <listitem>
53                                 <para>This field contains the position in pixel of the graphic
54                                     window on the screen. This is a vector <literal>[x,y]</literal>
55                                     defining the position of the upper-left corner of the window.
56                                     The position <literal>[0,0]</literal> is the upper-left corner of the
57                                     screen.
58                                 </para>
59                                 <para>The initial position of graphic windows is taken from the default figure entity (see
60                                     <link linkend="gdf">gdf</link>). The only exception is when default figure <literal>figure_position</literal>
61                                     value is <literal>[-1,-1]</literal>. In this case, the initial position of graphic windows is automatically set
62                                     by the windowing system.
63                                 </para>
64                             </listitem>
65                         </varlistentry>
66                         <varlistentry>
67                             <term>figure_size: </term>
68                             <listitem>
69                                 <para>This property controls the size in pixel of the screen's
70                                     graphics window. The size is the vector
71                                     <literal>[width,height]</literal>.
72                                 </para>
73                             </listitem>
74                         </varlistentry>
75                         <varlistentry>
76                             <term>axes_size: </term>
77                             <listitem>
78                                 <para>Used to Specifies the size in pixel of the virtual graphics
79                                     window. The size is the vector <literal>[width,height] </literal>. The
80                                     virtual graphic window should be bigger than the part really
81                                     visible on the screen. This property could not be modified if the figure is docked
82                                     with other elements.
83                                 </para>
84                             </listitem>
85                         </varlistentry>
86                         <varlistentry>
87                             <term>auto_resize: </term>
88                             <listitem>
89                                 <para>This property determines if graphics window is resized. If the
90                                     value is <literal>"on"</literal> then the <literal>axes_size</literal>
91                                     property is equaled to the <literal>figure_size</literal> and the axes
92                                     children are zoomed accordingly. If the value is
93                                     <literal>"off"</literal> that indicate that <literal>axes_size</literal>
94                                     cannot be resized when <literal>figure_size</literal> is changed.
95                                 </para>
96                             </listitem>
97                         </varlistentry>
98                         <varlistentry>
99                             <term>viewport: </term>
100                             <listitem>
101                                 <para>Position of the visible part of graphics in the
102                                     panner.
103                                 </para>
104                             </listitem>
105                         </varlistentry>
106                         <varlistentry>
107                             <term>figure_name or name:</term>
108                             <listitem>
109                                 <para>This field contains the name of the figure. This name is a
110                                     character string displayed at the top of the graphics_window. The
111                                     name can contain a single substring <literal>%d</literal> which will be
112                                     replaced by the <literal>figure_id</literal>. No other instance of the
113                                     <literal>%</literal> character is allowed inside the name.
114                                 </para>
115                             </listitem>
116                         </varlistentry>
117                         <varlistentry>
118                             <term>figure_id: </term>
119                             <listitem>
120                                 <para>This field contains the identifier of the figure. This is an
121                                     integer number which is set at figure creation and cannot be
122                                     changed after.
123                                 </para>
124                             </listitem>
125                         </varlistentry>
126                         <varlistentry>
127                             <term>color_map: </term>
128                             <listitem>
129                                 <para>Property which defines the colormap used by this figure. The
130                                     colormap is a <literal>m</literal> by <literal>3</literal> matrix.
131                                     <literal>m</literal> is the number of colors. Color number i is given as
132                                     a 3-uple <literal>R</literal>, <literal>G</literal>, <literal>B</literal>
133                                     corresponding respectively to red, green and blue intensity
134                                     between 0 and 1.
135                                 </para>
136                             </listitem>
137                         </varlistentry>
138                         <varlistentry>
139                             <term>pixel_drawing_mode: </term>
140                             <listitem>
141                                 <para>This field specifies the bitwise operation used for pixel rendering.
142                                     The default mode is <literal>copy</literal>.
143                                     For more details see the <link linkend="pixel_drawing_mode">pixel drawing mode reference page</link>.
144                                 </para>
145                             </listitem>
146                         </varlistentry>
147                         <varlistentry>
148                             <term>anti_aliasing: </term>
149                             <listitem>
150                                 <para>
151                                   This property controls the anti-aliasing level used to improve
152                                   graphic quality.
153                                   If the property is set to "off", anti-aliasing is disable.
154                                   To enable anti-aliasing, the property must set to either
155                                   "2x", "4x", "8x" or "16x". In this case, it stands for the
156                                   anti-aliasing level.
157                                   For example, "16x" is a higher quality level than "2x".
158                                   Specifying a higher anti-aliasing level improves image quality
159                                   but also decreases graphic performances.
160                                   Please visit the <link linkend="anti_aliasing">dedicated page</link>
161                                   to see specific examples.
162                                 </para>
163                             </listitem>
164                         </varlistentry>
165                         <varlistentry>
166                             <term>immediate_drawing: </term>
167                             <listitem>
168                                 <para>This property controls the figure display. Its value can be
169                                     <literal>"on"</literal> (default mode) or <literal>"off"</literal>. It is used
170                                     to delay a huge succession of graphics commands (implying several
171                                     drawings or redrawings). Note that, when using
172                                     <literal>drawlater</literal> or <literal>drawnow</literal> commands, it
173                                     affects the property value of the current figure (which is
174                                     respectively turned to <literal>'off'</literal> or
175                                     <literal>'on'</literal>).
176                                 </para>
177                             </listitem>
178                         </varlistentry>
179                         <varlistentry>
180                             <term>background: </term>
181                             <listitem>
182                                 <para>This property controls the figure window background color. It
183                                     takes as value an index relative to the current colormap.
184                                 </para>
185                             </listitem>
186                         </varlistentry>
187                         <varlistentry>
188                             <term>event_handler</term>
189                             <listitem>
190                                 <para>A character string. The name of the Scilab function which is intended
191                                     to handle the events. Note that setting an empty string will disable
192                                     the event handler. For more information about event handler functions see the
193                                     <link linkend="eventhandlerfunctions">event handler functions</link> help.
194                                 </para>
195                             </listitem>
196                         </varlistentry>
197                         <varlistentry>
198                             <term>event_handler_enable</term>
199                             <listitem>
200                                 <para>Enable or disable the event handler. Its value must be either
201                                     "on" or "off".
202                                 </para>
203                             </listitem>
204                         </varlistentry>
205                         <varlistentry>
206                             <term>user_data: </term>
207                             <listitem>
208                                 <para>This field can be use to store any scilab variable in the
209                                     figure data structure, and to retrieve it.
210                                 </para>
211                             </listitem>
212                         </varlistentry>
213                         <varlistentry>
214                             <term>tag: </term>
215                             <listitem>
216                                 <para>This field can be use to store a character string generally used to identify the control. It allows to give it a "name". Mainly used in conjunction with findobj().</para>
217                             </listitem>
218                         </varlistentry>
219                         <varlistentry>
220                             <term>resizefcn: </term>
221                             <listitem>
222                                 <para>This field can be used to store the name of a Scilab function or a Scilab expression as a character string. This character string will be evaluated whenever the user resizes the figure and when the figure is created. </para>
223                             </listitem>
224                         </varlistentry>
225                         <varlistentry>
226                             <term>closerequestfcn: </term>
227                             <listitem>
228                                 <para>This field can be used to store the name of a Scilab function or a Scilab expression as a character string. This character string will be evaluated whenever the user tries to close the figure using the top-right cross.</para>
229                                 <para>When this property is set, the "figure closed" event (-1000) will no more be trapped by the event handler function.</para>
230                             </listitem>
231                         </varlistentry>
232                         <varlistentry>
233                             <term>resize: </term>
234                             <listitem>
235                                 <para>
236                                     <literal>"on"</literal> (default value) allows the user to interactively resize the figure with the mouse.
237                                     <literal>"off"</literal> forbids to do it, but still allows using efficiently the <literal>.figure_size</literal> property.
238                                 </para>
239                             </listitem>
240                         </varlistentry>
241                         <varlistentry>
242                             <term>menubar_visible: </term>
243                             <listitem>
244                                 <para>
245                                     This property controls the figure menubar visibility. Its value can be <literal>"on"</literal> (default value) or <literal>"off"</literal>.
246                                 </para>
247                             </listitem>
248                         </varlistentry>
249                         <varlistentry>
250                             <term>toolbar_visible: </term>
251                             <listitem>
252                                 <para>
253                                     This property controls the figure toolbar visibility. Its value can be <literal>"on"</literal> (default value) or <literal>"off"</literal>.
254                                 </para>
255                             </listitem>
256                         </varlistentry>
257                         <varlistentry>
258                             <term>infobar_visible: </term>
259                             <listitem>
260                                 <para>
261                                     This property controls the figure status bar visibility. Its value can be <literal>"on"</literal> (default value) or <literal>"off"</literal>.
262                                 </para>
263                             </listitem>
264                         </varlistentry>
265                         <varlistentry>
266                             <term>info_message: </term>
267                             <listitem>
268                                 <para>This character string set the text displayed in the info bar of the
269                                     graphic window.
270                                 </para>
271                             </listitem>
272                         </varlistentry>
273                         <varlistentry>
274                             <term>visible: </term>
275                             <listitem>
276                                 <para>
277                                     When the figure <literal>"dockable"</literal> property is <literal>"off"</literal>, setting the <literal>"Visible"</literal> property affects the whole figure including its window decorations.
278                                 </para>
279                                 <para>
280                                     When the figure <literal>"dockable"</literal> property is <literal>"on"</literal> and the figure is docked with another one inside the same parent window, this field concerns only the figure children (See dedicated part below). If the figure is not docked with another one, then the <literal>"Visible"</literal> property behaves as if the figure <literal>"dockable"</literal> property was set to <literal>"off"</literal>.
281                                 </para>
282                             </listitem>
283                         </varlistentry>
284                         <varlistentry>
285                             <term>layout: </term>
286                             <listitem>
287                                 <para>
288                                     This property sets the layout used to dispose the figure children. See <link linkend="layout">layout</link> page for more information about available layouts.
289                                 </para>
290                             </listitem>
291                         </varlistentry>
292                         <varlistentry>
293                             <term>layout_options: </term>
294                             <listitem>
295                                 <para>
296                                     This property sets the options of the layout used to dispose the figure children. See <link linkend="layout">layout</link> page for more information about available options.
297                                 </para>
298                             </listitem>
299                         </varlistentry>
300                         <varlistentry>
301                             <term>icon: </term>
302                             <listitem>
303                                 <para>This field can be used to customize the icon of a Scilab figure.</para>
304                                 <para>
305                                     Its value is a character string containing the (absolute or relative to Scilab <link linkend="pwd">current working directory.</link> path of the image file containing the icon.
306                                 </para>
307                             </listitem>
308                         </varlistentry>
309                         <varlistentry>
310                             <term>default_axes: </term>
311                             <listitem>
312                                 <para>
313                                     <literal>"on"</literal> (default value) means that the figure has always
314                                     a default axes: it is automatically set at the figure creation,
315                                     or automatically reset when the last axes of the figure is
316                                     intentionally deleted.
317                                 </para>
318                                 <para>
319                                     <literal>"off"</literal> means that
320                                     <itemizedlist>
321                                         <listitem>
322                                             the newly created figure has no default axes.
323                                         </listitem>
324                                         <listitem>
325                                             for an existing figure, it is possible to actually delete
326                                             all its existing axes.
327                                         </listitem>
328                                     </itemizedlist>
329                                     In both cases,
330                                     <itemizedlist>
331                                         <listitem>
332                                             without any axes, the figure can't be the default
333                                             target of any plotting instruction. This feature
334                                             can be used to protect an interactive interface built in
335                                             a figure (like the demos and the ATOMS ones) from being the default
336                                             plotting target when there is no other proper opened
337                                             graphical figures.
338                                         </listitem>
339                                         <listitem>
340                                             It is still possible to force creating an axes using the
341                                             <link linkend="newaxes">newaxes</link> function.
342                                         </listitem>
343                                     </itemizedlist>
344                                 </para>
345                             </listitem>
346                         </varlistentry>
347                     </variablelist>
348                 </listitem>
349             </varlistentry>
350         </variablelist>
351         <variablelist>
352             <varlistentry>
353                 <term>Children's default values: </term>
354                 <listitem>
355                     <variablelist>
356                         <varlistentry>
357                             <term>visible: </term>
358                             <para>{"on"} | "off"</para>
359                             <listitem>
360                                 <para>This field sets if the contents of the figure (axes and uicontrols) has to be
361                                     redrawn. Its value should be <literal>"on"</literal> or <literal>"off"</literal>.
362                                 </para>
363                             </listitem>
364                         </varlistentry>
365                         <varlistentry>
366                             <term>rotation_style: </term>
367                             <para>{"unary"} | "multiple"</para>
368                             <listitem>
369                                 <para>This field is related to the "3D Rot" button. It takes
370                                     <literal>unary</literal> as value (default) in the aim to rotate only
371                                     selected 3D plot. In the other case its value can be
372                                     <literal>multiple</literal> : all 3D plots are rotated.
373                                 </para>
374                             </listitem>
375                         </varlistentry>
376                     </variablelist>
377                 </listitem>
378             </varlistentry>
379         </variablelist>
380         <variablelist>
381             <varlistentry>
382                 <term>Creation related properties: </term>
383                 <para>
384                     Some properties must be set at creation time using the <link linkend="figure">figure</link> function and will be then read-only.
385                 </para>
386                 <listitem>
387                     <variablelist>
388                         <varlistentry>
389                             <term>dockable</term>
390                             <listitem>
391                                 <para>
392                                     This property determines if created window can be docked inside Scilab environment. If its value is <literal>"on"</literal> then the window will have a bar enabling the user to dock/undock it. Else the window will look like a standard OS window. This value can only be set at creation.
393                                 </para>
394                             </listitem>
395                         </varlistentry>
396                         <varlistentry>
397                             <term>menubar</term>
398                             <listitem>
399                                 <para>{"figure"} | "none"</para>
400                                 <para>
401                                     This property determines the type of the menubar of the figure. If its value is <literal>"none"</literal> then the window will not have any menubar until a menu is added using <link linkend="uimenu">uimenu function</link>. Else the window will be created with default figure menus. This value can only be set at creation.
402                                 </para>
403                             </listitem>
404                         </varlistentry>
405                         <varlistentry>
406                             <term>toolbar</term>
407                             <listitem>
408                                 <para>{"figure"} | "none"</para>
409                                 <para>
410                                     This property determines the type of the toolbar of the figure. If its value is <literal>"none"</literal> then the window will not have any menubar. Else the window will be created with a default figure toolbar. This value can only be set at creation.
411                                 </para>
412                             </listitem>
413                         </varlistentry>
414                     </variablelist>
415                 </listitem>
416             </varlistentry>
417             <varlistentry>
418                 <term>Note on default values: </term>
419                 <listitem>
420                     <variablelist>
421                         <varlistentry>
422                             <term/>
423                             <listitem>
424                                 <para>All these listed properties and fields inherit from default
425                                     values stored in a figure model. These default values can be seen
426                                     and changed. To do so, use the <literal>get("default_figure")</literal>
427                                     command : it returns a graphic handle on the figure model. Note
428                                     that no graphic window is created by this command. The next
429                                     created figures will inherit from this model (see example 2
430                                     below).
431                                 </para>
432                             </listitem>
433                         </varlistentry>
434                     </variablelist>
435                 </listitem>
436             </varlistentry>
437         </variablelist>
438     </refsection>
439     <refsection>
440         <title>Examples</title>
441         <programlisting role="example">
442             <![CDATA[
443 lines(0) // disables vertical paging
444
445 //Example 1
446 f=get("current_figure") //get the handle of the current figure :
447                         //if none exists, create a figure and return the corresponding handle
448 f.figure_position
449 f.figure_size=[200,200]
450 f.background=2
451 f.children  // man can see that an Axes entity already exists
452 delete(f);
453 f=gcf(); // macro shortcut <=> f=get("current_figure")
454 f.immediate_drawing = "off";
455 plot2d() // nothing happens on the screen...
456 f.immediate_drawing = "on";
457
458 //Example 2 : default_figure settings
459 df=get("default_figure") // get the default values (shortcut is gdf() )
460 // Let's change the defaults...
461 df.color_map=hotcolormap(128)
462 df.background= 110 // set background toa kind of yellow (Note that we
463                    // are using a color index inside the color_map previously redefined)
464 scf(122); // creates new figure number 122 with the new default
465 plot2d()
466 scf(214);
467 t=-%pi:0.3:%pi;
468 plot3d(t,t,sin(t)'*cos(t),35,45,'X@Y@Z',[15,2,4]);
469  ]]>
470         </programlisting>
471     </refsection>
472     <refsection role="see also">
473         <title>See also</title>
474         <simplelist type="inline">
475             <member>
476                 <link linkend="eventhandlerfunctions">event handler functions</link>
477             </member>
478             <member>
479                 <link linkend="pixel_drawing_mode">pixel_drawing_mode</link>
480             </member>
481             <member>
482                 <link linkend="anti_aliasing">anti_aliasing</link>
483             </member>
484             <member>
485                 <link linkend="colormap">colormap</link>
486             </member>
487             <member>
488                 <link linkend="xname">xname</link>
489             </member>
490             <member>
491                 <link linkend="scf">scf</link>
492             </member>
493             <member>
494                 <link linkend="gcf">gcf</link>
495             </member>
496             <member>
497                 <link linkend="gdf">gdf</link>
498             </member>
499             <member>
500                 <link linkend="findobj">findobj</link>
501             </member>
502             <member>
503                 <link linkend="axes_properties">axes_properties</link>
504             </member>
505             <member>
506                 <link linkend="set">set</link>
507             </member>
508             <member>
509                 <link linkend="get">get</link>
510             </member>
511         </simplelist>
512     </refsection>
513     <refsection>
514         <title>History</title>
515         <revhistory>
516             <revision>
517                 <revnumber>5.5.0</revnumber>
518                 <revremark>
519                     <itemizedlist>
520                         <listitem>"visible" property meaning changed (uicontrols managed and the whole figure can be made invisible in some cases.</listitem>
521                         <listitem>"icon" property added to allow figure icon change.</listitem>
522                         <listitem>"menubar_visible" property added.</listitem>
523                         <listitem>"toolbar_visible" property added.</listitem>
524                         <listitem>"infobar_visible" property added.</listitem>
525                         <listitem>"resize" property added.</listitem>
526                         <listitem>"dockable" property added.</listitem>
527                         <listitem>"menubar" property added.</listitem>
528                         <listitem>"toolbar" property added.</listitem>
529                         <listitem>"default_axes" property added.</listitem>
530                         <listitem>"layout" property added.</listitem>
531                         <listitem>"layout_options" property added.</listitem>
532                     </itemizedlist>
533                 </revremark>
534             </revision>
535             <revision>
536                 <revnumber>5.4.0</revnumber>
537                 <revremark>New resizefcn &amp; closerequestfcn properties introduced.</revremark>
538             </revision>
539         </revhistory>
540     </refsection>
541 </refentry>