User Tools

Site Tools


software:scilab:graphic:start

Graphic

Graphics are made up by hierarchical entities. From top to bottom, the first two are:

  1. Figure
  2. Axes

Further entities can exist depending on the structure of the graphic itself. For instance, to inspect a graphic from the top level, get an instance of the Figure entity:

x = [1:4]
y = x^2
plot(x, y)

f0 = gcf() // figure's handle
a0 = gca()  // axes' handle

Its properties can be inspected with the disp() command:

--> disp(f0)

Handle of type "Figure" with properties:
========================================
children: "Axes"
figure_position = [200,200]
figure_size = [612,579]
axes_size = [610,460]
auto_resize = "on"
viewport = [0,0]
figure_name = "Graphic window number %d"
figure_id = 0
info_message = ""
color_map = matrix 32x3
pixel_drawing_mode = "copy"
anti_aliasing = "off"
immediate_drawing = "on"
background =  -2
visible = "on"
rotation_style = "unary"
event_handler = ""
event_handler_enable = "off"
user_data = []
resizefcn = ""
closerequestfcn = ""
resize = "on"
toolbar = "figure"
toolbar_visible = "on"
menubar = "figure"
menubar_visible = "on"
infobar_visible = "on"
dockable = "on"
layout = "none"
layout_options = "OptNoLayout"
default_axes = "on"
icon = ""
tag = ""

The children property allows to inspect the lower entity (same result can be obtained inspecting directly the axes'instance):

--> disp(f0.children)  // --> disp(a0)

Handle of type "Axes" with properties:
======================================
parent: Figure
children: ["Text";"Text";"Text";"Text";"Compound"]
 
visible = "on"
axes_visible = ["on","on","on"]
axes_reverse = ["off","off","off"]
grid = [-1,-1]
grid_position = "background"
grid_thickness = [1,1]
grid_style = [3,3]
x_location = "bottom"
y_location = "left"
title: "Label"
x_label: "Label"
y_label: "Label"
z_label: "Label"
auto_ticks = ["on","on","on"]
x_ticks.locations = matrix 16x1
y_ticks.locations = [0;2;4;6;8;10;12;14;16]
z_ticks.locations = []
x_ticks.labels = matrix 16x1
y_ticks.labels = ["0";"2";"4";"6";"8";"10";"12";"14";"16"]
z_ticks.labels = []
ticks_format = ["","",""]
ticks_st = [1,1,1;0,0,0]
box = "on"
filled = "on"
sub_ticks = [1,1]
font_style = 6
font_size = 1
font_color = -1
fractional_font = "off"
 
isoview = "off"
cube_scaling = "off"
view = "2d"
rotation_angles = [0,270]
log_flags = "nnn"
tight_limits = ["off","off","off"]
data_bounds = [1,1;4,16]
zoom_box = []
margins = [0.125,0.125,0.125,0.125]
auto_margins = "on"
axes_bounds = [0,0,1,1]
 
auto_clear = "off"
auto_scale = "on"
 
hidden_axis_color = 4
hiddencolor = 4
line_mode = "on"
line_style = 1
thickness = 1
mark_mode = "off"
mark_style = 0
mark_size_unit = "tabulated"
mark_size = 0
mark_foreground = -1
mark_background = -2
foreground = -1
background = -2
arc_drawing_method = "lines"
clip_state = "clipgrf"
clip_box = []
user_data = []
tag = ""

Proceeding further, in the same manner:

--> disp(f0.children.children)

5 by 1 matrix of handles:
=========================
Text     
Text     
Text     
Text     
Compound 

To know the type of handle, inspect the property type. In this way it's possibile to access only a specific entity:

for i = 1:length(f0.children.children)
    if f0.children.children(i).type == "Text" then
        disp(f0.children.children(i))
    end
end
software/scilab/graphic/start.txt · Last modified: 2020/07/25 08:56 by tormec