plopp.inspector#
- plopp.inspector(obj, dim=None, *, aspect=None, autoscale=True, cbar=True, clabel=None, cmax=None, cmin=None, continuous_update=True, coords=None, errorbars=True, figsize=None, grid=False, legend=True, logc=None, mask_cmap='gray', mask_color='black', mode='point', nan_color=None, norm=None, operation='sum', orientation='horizontal', title=None, vmax=None, vmin=None, xlabel=None, xmax=None, xmin=None, ylabel=None, ymax=None, ymin=None, with_slider=True, **kwargs)[source]#
Inspector takes in a three-dimensional input and applies a reduction operation (
'sum'by default) along one of the dimensions specified bydim. It displays the result as a two-dimensional image. In addition, an ‘inspection’ tool is available in the toolbar. Inmode='point'it allows placing point markers on the image to slice at that position, retaining only the third dimension and displaying the resulting one-dimensional slice in the right-hand side figure. Inmode='polygon'it allows drawing a polygon to compute the total intensity inside the polygon as a function of the third dimension. Inmode='rectangle'it allows drawing a rectangle to compute the total intensity inside the rectangle as a function of the third dimension.Controls (point mode): - Left-click to make new points - Left-click and hold on point to move point - Middle-click to delete point
Controls (rectangle mode): - Left-click to make new rectangles - Left-click and hold on rectangle vertices to resize rectangle - Right-click and hold to drag/move the entire rectangle - Middle-click to delete rectangle
Controls (polygon mode): - Left-click to make new polygons - Left-click and hold on polygon vertex to move vertex - Right-click and hold to drag/move the entire polygon - Middle-click to delete polygon
Notes
Almost all the arguments for plot customization apply to the two-dimensional image (unless specified).
In rectangle mode, if any part of a data pixel lies inside the rectangle, the whole pixel is included in the selected region (as opposed to computing the overlap area). This is because it is not always possible to know how the bin fraction should be included, depending on the reduction operation which is applied to the data (sum, mean, etc). If one of the edges of the rectangle lies exactly on a bin edge between two data points, the selected region does not include the data on the outside of the rectangle, even though the edge is touching the rectangle.
In polygon mode, only data whose bin centers are inside the polygon are included in the selected region.
- Parameters:
obj (
Variable|DataArray|Dataset|DataGroup[Any] |ndarray|Node) – The object to be plotted.dim (
str|None, default:None) – The dimension along which to apply the reduction operation. This will also be the dimension that remains in the one-dimensional slices generated by adding markers on the image. If no dim is provided, the last (inner) dim of the input data will be used.aspect (
Optional[Literal['auto','equal']], default:None) – Aspect ratio for the axes.autoscale (
bool, default:True) – Automatically scale the axes/colormap on updates ifTrue.cbar (
bool, default:True) – Show colorbar ifTrue.cmax (
Variable|float|None, default:None) – Upper limit for colorscale.cmin (
Variable|float|None, default:None) – Lower limit for colorscale.continuous_update (
bool, default:True) – IfTrue, update the data selected by the markers, rectangles, or polygons continuously as they are being moved or resized. IfFalse, only update the data when the user releases the mouse button after moving/resizing.coords (
list[str] |None, default:None) – If supplied, use these coords instead of the input’s dimension coordinates.errorbars (
bool, default:True) – Show errorbars ifTrue(1d figure).figsize (
tuple[float,float] |None, default:None) – The width and height of the figure, in inches.grid (
bool, default:False) – Show grid ifTrue.legend (
bool|tuple[float,float], default:True) – Show legend ifTrue. Iflegendis a tuple, it should contain the(x, y)coordinates of the legend’s anchor point in axes coordinates (1d figure).logc (
bool|None, default:None) – IfTrue, use logarithmic scale for colorscale.mask_cmap (
str, default:'gray') – Colormap to use for masks.mask_color (
str, default:'black') – Color of masks (overridesmask_cmap).mode (
Literal['point','polygon','rectangle'], default:'point') – Select'point'for point inspection,'polygon'for polygon selection, or'rectangle'for rectangle selection with total intensity inside the shape plotted as a function ofdim.nan_color (
str|None, default:None) – Color to use for NaN values.norm (
Optional[Literal['linear','log']], default:None) – Set to'log'for a logarithmic colorscale. Legacy, preferlogcinstead.operation (
Literal['sum','mean','min','max','nansum','nanmean','nanmin','nanmax'], default:'sum') – The operation to apply along the third (undisplayed) dimension specified bydim. The same operation is also applied to the data within the selected region in the case ofpolygonandrectanglemodes.orientation (
Literal['horizontal','vertical'], default:'horizontal') – Display the two panels side-by-side (‘horizontal’) or one below the other (‘vertical’).vmax (
Variable|float|None, default:None) – Upper limit for data colorscale to be displayed. Legacy, prefercmaxinstead.vmin (
Variable|float|None, default:None) – Lower limit for data colorscale to be displayed. Legacy, prefercmininstead.xmax (
Variable|float|None, default:None) – Upper limit for x-axis (1d figure)xmin (
Variable|float|None, default:None) – Lower limit for x-axis (1d figure)ymax (
Variable|float|None, default:None) – Upper limit for y-axis (1d figure).ymin (
Variable|float|None, default:None) – Lower limit for y-axis (1d figure).with_slider (
bool, default:True) – Show slider under 2d image for selecting data range ifTrue. A currently selected range indicator will also be displayed on the 1d profile figure.**kwargs – Additional arguments forwarded to the underlying plotting library.
- Returns:
A
Boxwhich will contain twoFigureand one slider widget.