10.7. figure#
- class itom.figure(handle=-1, rows=1, cols=1, x0=-1, y0=-1, width=-1, height=-1)
Bases:
uiItemCreates a new figure window.
The class
figurerepresents 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
rowsandcols. 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
widthandheight, 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
geometryof 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
x0is != -1, its left position is set to this value.- y0
int,optional If
y0is != -1, its top position is set to this value.- width
int,optional If
widthis != -1, the width of the figure window is set to this value.- height
int,optional If
heightis != -1, the height of the figure window is set to this value.
- handle
- Returns:
figureis 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
handleis 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
figureinstance 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
classNameis 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
classNameto 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.uiIteminstance.Use the
propertiesargument 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
areaIndexis the current subplot area, hence,0if only one plot area exists in the figure.- className
str,optional class name of desired plot (if not indicated or if the
classNamecannot 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.figureof 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
areaIndexis the current subplot area, hence,0if 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,pointCloudorpolygonMeshin the newly created plot. The style of the plot depends on the object dimensions.If no
classNameis 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 setclassNameto1D,2Dor2.5Din order to choose the default plot type depending on these aliases. ForpointCloudandpolygonMeshonly the alias2.5Dis 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.uiIteminstance.Use the
propertiesargument to pass a dictionary with properties you want to set to certain values.- Parameters:
- data
dataObjectorpointCloudorpolygonMesh 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
areaIndexis the current subplot area, hence,0if only one plot area exists in the figure.- className
str,optional class name of desired plot (if not indicated or if the
classNamecannot 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
datain the current or given area of this figure.If
xDatais given, the plot uses this vector for the values of thex-axisof the plot.The plot type of this function is
1D(see methodfigure.plot()). If aclassNameis 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 correspondinguiIteminstance.Use the
propertiesargument 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
areaIndexis the current subplot area, hence,0if only one plot area exists in the figure.- className
str,optional class name of desired plot (if not indicated or if the
classNamecannot 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
datain the current or given area of this figure.This method plots an existing
dataObjectin 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 correspondinguiIteminstance.Use the
propertiesargument to pass a dictionary with properties you want to set.- Parameters:
- data
dataObject is the data, that should be plotted. If a
classNameit must support dataObjects as accepted data type. Else, the defaultclassNamefor 2DdataObjectis 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
areaIndexis the current subplot area, hence,0if only one plot area exists in the figure.- className
str,optional class name of desired plot (if not indicated or if the
classNamecannot 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
dataobject 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 correspondinguiIteminstance.Use the
propertiesargument to pass a dictionary with properties you want to set.- Parameters:
- data
dataObjectorpointCloudorpolygonMesh is the data, that should be plotted. If a
classNameis given, only the type of data, supported by this class, can be displayed. Else, the defaultclassNamefor 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
areaIndexis the current subplot area, hence,0if only one plot area exists in the figure.- className
str,optional class name of desired plot (if not indicated or if the
classNamecannot 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
areaIndexis the current subplot area, hence,0if 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.