Graphics Entities

description of the graphics entities data structures

Description

In Scilab, graphics window and the drawing it contains are
represented by hierarchical entities. The hierarchy top level is the
Figure. Each Figure defines at
least one child of type Axes. Each
Axes entity contains a set of leaf
entities which are the basic graphics objects like
Polylines, Rectangles,
Arcs, Segs,... It can also
contain an Compound type which is recursive
set of entities. The main interest of the graphic mode is to make
property change easier. This graphics' mode provides a set of
high-level graphing routines (see set,
get) used to control objects' properties
such as data, coordinates and scaling, color and appearances without
requiring to replay the initial graphics commands.

Graphics entities are associated to Scilab variables of type
handle. The handle is an unique identifier which
is associated to each instance of a created graphical entity. Using
this handle, it will be possible to reach entities' properties
through set and get
routines. The handles are also used to manipulate graphics objects, to move them, to make copies or delete them.

Figure:

The Figure entity is the top level of the graphics
entities hierarchy. This entity defines the parameters
for the figure itself as well as the parameters' default
values for the children creation. The figure children
are the Axes entities.

The handle on the current figure (the figure used where
the drawing are sent) may be got using
get("current_figure") and it may be set
using set("current_figure",h), where
h is either a handle on a figure or a
figure_id. In this last case if the
figure does not already exists, it is created.

The Axes entity is the second level
of the graphics entities hierarchy. This entity defines
the parameters for the change of coordinates and the
axes drawing as well as the parameters' default values
for its children creation. See axes properties for
details. The handle on the current Axes may be got using
get("current_axes").

Compound:

The Compound entity is just a vector
of children and with a single property (visibility
property). It is used to glue a set of entities
together.

Lights in scilab approximates real world lighting where the appearance of
a surface is given by interactions between light rays and the material properties of the
surface. Because simulate real world lighting is complex
and computationally expensive, one uses a simplified model.

Examples

//Play this example line per linescf()//create a figure in entity mode//get the handle on the Figure entity and display its propertiesf=get("current_figure")a=f.children// the handle on the Axes childx=(1:10)';plot2d(x,[x.^2x.^1.5])e=a.children//Compound of 2 polylinesp1=e.children(1)//the last drawn polyline propertiesp1.foreground=5;// change the polyline colore.children.thickness=5;// change the thickness of the two polylinesdelete(e.children(2))move(e.children,[0,30])//translate the polylinea.axes_bounds=[000.50.5];subplot(222)//create a new Axes entityplot(1:10);a1=f.children(1);//get its handlecopy(e.children,a1);//copy the polyline of the first plot in the new Axesa1.data_bounds=[10;10100];//change the Axes boundsset("current_figure",10)//create a new figure with figure_id=10plot3d()//the drawing are sent to figure 10set("current_figure",f)//make the previous figure the current oneplot2d(x,x^3)//the drawing are sent to the initial figure

See also

set — set a property value of a graphic entity
object or of a User Interface object.

get — Retrieve a property value from a graphics
entity or an User Interface object.