Note
Go to the end to download the full example code.
12.1.10.5.17. 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"]
[1545, 774, 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): [1544, 743, 752, 482]
figure position (x,y): [1544, 743]
x, y: 1544 743
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): [1545, 774, 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.063 seconds)