10.7. figure#
- class itom.figure(handle=-1, rows=1, cols=1, x0=-1, y0=-1, width=-1, height=-1)
Bases:
uiItem
Creates a new figure window.
The class
figure
represents a standalone figure window, that can have various subplots. If an instance of this class is created without further parameters, a new figure is created and opened having one subplot area (currently empty) and the integer handle to this figure is returned:h: int = figure()
Subplots are arranged in a regular grid whose size is defined by the optional parameters
rows
andcols
. If you create a figure instance with a given handle, the instance is either a reference to an existing figure that has got this handle or if it does not exist, a new figure with the desired handle is opened and the handle is returned, too.Using the parameters
width
andheight
, it is possible to control the size of the figure. If one of both parameters are not set or <= 0 (default), no size adjustment is done at all.The size and position control can afterwards done using the property
geometry
of the figure.- Parameters:
- handle
int
integer handle of the desired figure.
- rows
int
,optional
number of rows this figure should have (defines the size of the subplot-grid)
- cols
int
,optional
number of columns this figure should have (defines the size of the subplot-grid)
- x0
int
,optional
If
x0
is != -1, its left position is set to this value.- y0
int
,optional
If
y0
is != -1, its top position is set to this value.- width
int
,optional
If
width
is != -1, the width of the figure window is set to this value.- height
int
,optional
If
height
is != -1, the height of the figure window is set to this value.
- handle
- Returns:
figure
is the reference to the newly created figure object.
- static close(handle) None
- static close(all='all') None
Closes a specific or all opened figures.
This method closes and deletes either one specific figure (if
handle
is given and valid), or all opened figures (if the string argument"all"
is given). All figure can only be closed, if no other figure references this figure (e.g. line cut of an image plot (2D).- Parameters:
See also
Notes
If a
figure
instance still keeps a reference to any figure, it is only closed and will be deleted after that the last referencing instance has been deleted.
- hide()
Hides the figure, but does not delete it.
- liveImage(cam, areaIndex=currentAreaIndex, className='', properties={}) plotItem
Shows a camera live image in the current or given area of this figure.
If no
className
is given, the type of the plot is chosen depending on the type and the size of the object. The defaults for several plot classes can be adjusted in the property dialog of itom.You can also set a class name of your preferred plot plugin (see also property dialog of itom). If your preferred plot is not able to display the given object, a warning is returned and the default plot type is used again. For dataObjects, it is also possible to simply set
className
to 1D or 2D in order to choose the default plot type depending on these aliases.Every plot has several properties that can be configured in the Qt Designer (if the plot is embedded in a GUI), or by the property toolbox in the plot itself or by using the
info()
method of the correspondingitom.uiItem
instance.Use the
properties
argument to pass a dictionary with properties you want to set to certain values.- Parameters:
- cam
dataIO
Camera grabber device from which images are acquired.
- areaIndex
int
,optional
Area index where the plot canvas should be created (if subplots exists). The default
areaIndex
is the current subplot area, hence,0
if only one plot area exists in the figure.- className
str
,optional
class name of desired plot (if not indicated or if the
className
cannot be found, the default plot will be used (see application settings)- properties
dict
,optional
Optional dictionary of properties that will be directly applied to the plot widget.
- cam
- Returns:
- plotHandle
plotItem
Handle of the subplot. This handle is used to control the properties of the plot, connect signals to it or call slots of the plot.
- plotHandle
- matplotlibFigure(areaIndex=currentAreaIndex, properties={}) plotItem
Creates a matplotlib canvas at the given area in the figure.
Creates and returns a matplotlib canvas at the given area or returns an existing one. This canvas can be used as canvas argument for
matplotlib.pyplot.figure
of matplotlib and is internally used by the itom backend of matplotlib.- Parameters:
- areaIndex
int
,optional
Area index where the plot canvas should be created (if subplots exists). The default
areaIndex
is the current subplot area, hence,0
if only one plot area exists in the figure.- properties
dict
,optional
Optional dictionary of properties that will be directly applied to the plot widget.
- areaIndex
- Returns:
- plotHandle
plotItem
Handle of the subplot. This handle is used to control the properties of the plot, connect to its signals or call slots of the plot.
- plotHandle
- plot(data, areaIndex=currentAreaIndex, className='', properties={}) plotItem
Plots a dataObject, pointCloud or polygonMesh in the current or given area of this figure.
Plots an existing
dataObject
,pointCloud
orpolygonMesh
in the newly created plot. The style of the plot depends on the object dimensions.If no
className
is given, the type of the plot is chosen depending on the type and the size of the object. The defaults for several plot classes can be adjusted in the property dialog of itom.You can also set a class name of your preferred plot plugin (see also property dialog of itom). If your preferred plot is not able to display the given object, a warning is returned and the default plot type is used again. For
dataObject
, it is also possible to simply setclassName
to1D
,2D
or2.5D
in order to choose the default plot type depending on these aliases. ForpointCloud
andpolygonMesh
only the alias2.5D
is valid.Every plot has several properties that can be configured in the Qt Designer (if the plot is embedded in a GUI), or by the property toolbox in the plot itself or by using the
info()
method of the correspondingitom.uiItem
instance.Use the
properties
argument to pass a dictionary with properties you want to set to certain values.- Parameters:
- data
dataObject
orpointCloud
orpolygonMesh
Is the data object whose region of interest will be plotted.
- areaIndex
int
,optional
Area index where the plot canvas should be created (if subplots exists). The default
areaIndex
is the current subplot area, hence,0
if only one plot area exists in the figure.- className
str
,optional
class name of desired plot (if not indicated or if the
className
cannot be found, the default plot will be used (see application settings)- properties
dict
,optional
Optional dictionary of properties that will be directly applied to the plot widget.
- data
- Returns:
- plotHandle
plotItem
Handle of the subplot. This handle is used to control the properties of the plot, connect signals to it or call slots of the plot.
- plotHandle
- plot1(data, xData=None, areaIndex=currentAreaIndex, className='', properties={}) plotItem
Creates a 1D plot of a dataObject
data
in the current or given area of this figure.If
xData
is given, the plot uses this vector for the values of thex-axis
of the plot.The plot type of this function is
1D
(see methodfigure.plot()
). If aclassName
is given, that does not support the given type ofdata
(orxData
) a warning is returned and the default plot class for the given data is used again.Every plot has several properties that can be configured in the Qt Designer (if the plot is embedded in a GUI), or by the property toolbox in the plot itself or by using the
info()
method of the correspondinguiItem
instance.Use the
properties
argument to pass a dictionary with properties you want to set.- Parameters:
- data
dataObject
Is the data object whose region of interest will be plotted.
- xData
dataObject
,optional
1D plots can optionally accept this
dataObject
. If given, the values are not displayed on an equally distributed x-scale but with the values given byxData
.- areaIndex
int
,optional
Area index where the plot canvas should be created (if subplots exists). The default
areaIndex
is the current subplot area, hence,0
if only one plot area exists in the figure.- className
str
,optional
class name of desired plot (if not indicated or if the
className
cannot be found, the default plot will be used (see application settings)- properties
dict
,optional
Optional dictionary of properties that will be directly applied to the plot widget.
- data
- Returns:
- plotHandle
plotItem
Handle of the subplot. This handle is used to control the properties of the plot, connect signals to it or call slots of the plot.
- plotHandle
- plot2(data, areaIndex=currentAreaIndex, className='', properties={}) plotItem
Creates a 2D plot of a dataObject
data
in the current or given area of this figure.This method plots an existing
dataObject
in the new 2D plot. The style of the plot depends on the object dimensions. The plot type of this function is2D
(see methodfigure.plot()
).If the 2D plot is not able to display the given object, a warning is returned and the default plot type is used again.
Every plot has several properties that can be configured in the Qt Designer (if the plot is embedded in a GUI), or by the property toolbox in the plot itself or by using the
info()
method of the correspondinguiItem
instance.Use the
properties
argument to pass a dictionary with properties you want to set.- Parameters:
- data
dataObject
is the data, that should be plotted. If a
className
it must support dataObjects as accepted data type. Else, the defaultclassName
for 2DdataObject
is chosen (see itom application settings for default plot types.- areaIndex
int
,optional
Area index where the plot canvas should be created (if subplots exists). The default
areaIndex
is the current subplot area, hence,0
if only one plot area exists in the figure.- className
str
,optional
class name of desired plot (if not indicated or if the
className
cannot be found, the default plot will be used (see application settings)- properties
dict
,optional
Optional dictionary of properties that will be directly applied to the plot widget.
- data
- Returns:
- plotHandle
plotItem
Handle of the subplot. This handle is used to control the properties of the plot, connect signals to it or call slots of the plot.
- plotHandle
- plot25(data, areaIndex=currentAreaIndex, className='', properties={}) plotItem
Creates a 2.5D plot of a dataObject, pointCloud or polygonMesh in the current or given area of this figure.
This method plots
data
object in the new plot. The style of the plot depends on the object dimensions, its plot type is2.5D
(see methodfigure.plot()
).If the 2.5D plot is not able to display the given object, a warning is returned and the default plot type is used again.
Every plot has several properties that can be configured in the Qt Designer (if the plot is embedded in a GUI), or by the property toolbox in the plot itself or by using the
info()
method of the correspondinguiItem
instance.Use the
properties
argument to pass a dictionary with properties you want to set.- Parameters:
- data
dataObject
orpointCloud
orpolygonMesh
is the data, that should be plotted. If a
className
is given, only the type of data, supported by this class, can be displayed. Else, the defaultclassName
for the kind of data is chosen (see itom application settings for default plot types.- areaIndex
int
,optional
Area index where the plot canvas should be created (if subplots exists). The default
areaIndex
is the current subplot area, hence,0
if only one plot area exists in the figure.- className
str
,optional
class name of desired plot (if not indicated or if the
className
cannot be found, the default plot will be used (see application settings)- properties
dict
,optional
Optional dictionary of properties that will be directly applied to the plot widget.
- data
- Returns:
- plotHandle
plotItem
Handle of the subplot. This handle is used to control the properties of the plot, connect signals to it or call slots of the plot.
- plotHandle
- plotlyFigure(areaIndex=currentAreaIndex, properties={}) plotItem
Creates a plotly canvas at the given area in the figure.
Creates and returns a plotly canvas at the given area or returns an existing one. If the itom plotly renderer is used, this renderer calls this method to send the html output to this widget.
- Parameters:
- areaIndex
int
,optional
Area index where the plot canvas should be created (if subplots exists). The default
areaIndex
is the current subplot area, hence,0
if only one plot area exists in the figure.- properties
dict
,optional
Optional dictionary of properties that will be directly applied to the plot widget.
- areaIndex
- Returns:
- plotHandle
plotItem
Handle of the subplot. This handle is used to control the properties of the plot, connect to its signals or call slots of the plot.
- plotHandle
- show()
Shows the figure if it is currently hidden.
- docked
bool
: gets or sets the docked status of this figure.This attribute controls the dock appearance of this figure. If it is docked, the figure is integrated into the main window of itom, else it is a independent window.
- handle
int
: gets the handle of this figure.