plopp.graphics.ImageView#

class plopp.graphics.ImageView(*nodes, cmap='viridis', mask_cmap='gray', norm='linear', vmin=None, vmax=None, autoscale='auto', scale=None, aspect='auto', grid=False, cbar=True, title=None, figsize=None, format=None, **kwargs)[source]#

ImageView that makes a visual representation of two-dimensional data. It has a Canvas, a ColorMapper and a specialized update function that generates Image artists.

Parameters:
  • *nodes – The nodes that are attached to the view.

  • cmap (str, default: 'viridis') – The name of the colormap for the data (see https://matplotlib.org/stable/tutorials/colors/colormaps.html). In addition to the Matplotlib docs, if the name is just a single html color, a colormap with that single color will be used.

  • mask_cmap (str, default: 'gray') – The name of the colormap for masked data.

  • norm (Literal['linear', 'log'], default: 'linear') – Control the scaling on the vertical axis.

  • vmin (Union[Variable, int, float, None], default: None) – Lower bound for the colorbar. If a number (without a unit) is supplied, it is assumed that the unit is the same as the data unit.

  • vmax (Union[Variable, int, float, None], default: None) – Upper bound for the colorbar. If a number (without a unit) is supplied, it is assumed that the unit is the same as the data unit.

  • autoscale (Literal['auto', 'grow'], default: 'auto') – The behavior of the color range limits. If auto, the limits automatically adjusts every time the data changes. If grow, the limits are allowed to grow with time but they do not shrink.

  • scale (Optional[Dict[str, str]], default: None) – Control the scaling of the horizontal axis. For example, specify scale={'tof': 'log'} if you want log-scale for the tof dimension.

  • aspect (Literal['auto', 'equal'], default: 'auto') – Aspect ratio for the axes.

  • grid (bool, default: False) – Show grid if True.

  • cbar (bool, default: True) – Show colorbar if True.

  • title (Optional[str], default: None) – The figure title.

  • figsize (Optional[Tuple[float, float]], default: None) – The width and height of the figure, in inches.

  • ax – If supplied, use these axes to create the figure. If none are supplied, the canvas will create its own axes.

  • cax – If supplied, use these axes for the colorbar. If none are supplied, and a colorbar is required, the canvas will create its own axes.

  • format (Optional[Literal['svg', 'png']], default: None) – Format of the figure displayed in the Jupyter notebook. If None, a SVG is created as long as the number of markers in the figure is not too large. If too many markers are drawn, a PNG image is created instead.

  • **kwargs – All other kwargs are forwarded to the Image artist.

__init__(*nodes, cmap='viridis', mask_cmap='gray', norm='linear', vmin=None, vmax=None, autoscale='auto', scale=None, aspect='auto', grid=False, cbar=True, title=None, figsize=None, format=None, **kwargs)[source]#

Methods

__init__(*nodes[, cmap, mask_cmap, norm, ...])

make_artist(new_values)

notify_view(message)

When a notification is received, request data from the corresponding parent node and update the relevant artist.

render()

At the end of figure creation, this function is called to request data from all parent nodes and draw the figure.

update(*args, **kwargs)

Update the view with new data by either supplying a dictionary of new data or by keyword arguments.

Attributes

id

The unique id of the view.