hexsample.display — Display facilities#

Module documentation#

Display facilities.

class hexsample.display.HexagonCollection(x, y, radius: float, orientation: float = 0.0, **kwargs)#

Collection of native matplotlib hexagon patches.

Parameters:
  • x (array_like) – The x coordinates of the hexagon centers.

  • y (array_like) – The y coordinates of the hexagon centers.

  • radius (float) – The distance from the center to each of the hexagon vertices.

  • orientation (float) – The hexagon orientation in radians—zero means pointy topped.

set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, array=<UNSET>, capstyle=<UNSET>, clim=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, cmap=<UNSET>, color=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, gid=<UNSET>, hatch=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, mouseover=<UNSET>, norm=<UNSET>, offset_transform=<UNSET>, offsets=<UNSET>, path_effects=<UNSET>, paths=<UNSET>, picker=<UNSET>, pickradius=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, urls=<UNSET>, visible=<UNSET>, zorder=<UNSET>)#

Set multiple properties at once.

Supported properties are

Properties:

agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image alpha: array-like or scalar or None animated: bool antialiased or aa or antialiaseds: bool or list of bools array: array-like or None capstyle: .CapStyle or {‘butt’, ‘projecting’, ‘round’} clim: (vmin: float, vmax: float) clip_box: ~matplotlib.transforms.BboxBase or None clip_on: bool clip_path: Patch or (Path, Transform) or None cmap: .Colormap or str or None color: :mpltype:`color` or list of RGBA tuples edgecolor or ec or edgecolors: :mpltype:`color` or list of :mpltype:`color` or ‘face’ facecolor or facecolors or fc: :mpltype:`color` or list of :mpltype:`color` figure: ~matplotlib.figure.Figure gid: str hatch: {‘/’, ‘\’, ‘|’, ‘-’, ‘+’, ‘x’, ‘o’, ‘O’, ‘.’, ‘*’} in_layout: bool joinstyle: .JoinStyle or {‘miter’, ‘round’, ‘bevel’} label: object linestyle or dashes or linestyles or ls: str or tuple or list thereof linewidth or linewidths or lw: float or list of floats mouseover: bool norm: .Normalize or str or None offset_transform or transOffset: .Transform offsets: (N, 2) or (2,) array-like path_effects: list of .AbstractPathEffect paths: unknown picker: None or bool or float or callable pickradius: float rasterized: bool sketch_params: (scale: float, length: float, randomness: float) snap: bool or None transform: ~matplotlib.transforms.Transform url: str urls: list of str or None visible: bool zorder: float

class hexsample.display.HexagonalGridDisplay(grid: HexagonalGrid, **kwargs)#

Display for an HexagonalGrid object.

static setup_gca()#

Setup the current axes object to make the display work.

static show()#

Convenience function to setup the matplotlib canvas for an event display.

pha_to_colors(pha: array, zero_sup_threshold: float = None) array#

Convert the pha values to colors for display purposes.

static brightness(color: array) array#

Quick and dirty proxy for the brighness of a given array of colors.

See https://stackoverflow.com/questions/9733288 and also https://stackoverflow.com/questions/30820962 for how to split in columns the array of colors.

draw(offset: Tuple[float, float] = (0.0, 0.0), pixel_labels: bool = False, **kwargs) HexagonCollection#

Draw the full grid display.

draw_roi(roi: RegionOfInterest, offset: Tuple[float, float] = (0.0, 0.0), indices: bool = True, padding: bool = True, **kwargs) HexagonCollection#

Draw a given ROI.

draw_digi_event(event: DigiEventRectangular, offset: Tuple[float, float] = (0.0, 0.0), indices: bool = True, padding: bool = True, zero_sup_threshold: float = 0, values: bool = True, **kwargs) HexagonCollection#

Draw an actual event int the parent hexagonal grid.

This is taking over where the draw_roi() hook left, and adding the event part.