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