12.1.10.5.5. Figure positioningΒΆ

Demo for getting/setting the size and position of a figure.

from itom import figure
from itom import dataObject


fig = figure()
fig.plot(dataObject.randN([100, 200]))

fig["geometry"]
[585, 300, 750, 450]

Frame of figure window is the entire window including any title bar and window frame.

properties: frameGeometry, x, y

print("figure frame geometry (x,y,w,h):", fig["frameGeometry"])
print("figure position (x,y):", fig["pos"])
print("x, y:", fig["x"], fig["y"])
figure frame geometry (x,y,w,h): [584, 277, 752, 474]
figure position (x,y): [584, 277]
x, y: 584 277

The real plot area of the figure is accessible by geometry, size, width, height.

print("figure geometry (x,y,w,h):", fig["geometry"])
print("figure size (w,h):", fig["size"])
print("figure width:", fig["width"])
print("figure height:", fig["height"])
figure geometry (x,y,w,h): [585, 300, 750, 450]
figure size (w,h): [750, 450]
figure width: 750
figure height: 450

In order to change the outer position use the property pos.

fig["pos"] = (0, 0)

Size change: property size.

fig["size"] = (500, 400)

In order to change the inner position and size use the property geometry.

fig["geometry"] = (100, 200, 300, 200)

Total running time of the script: ( 0 minutes 0.165 seconds)