KekLib.MplUtils

KekLib.MplUtils#

MplUtils.py

Copyright (c) 2022, SAXS Team, KEK-PF

class BoundaryNorm(*args, **kwargs)#

Bases: BoundaryNorm

Parameters:
  • boundaries (array-like) – Monotonically increasing sequence of at least 2 bin edges: data falling in the n-th bin will be mapped to the n-th color.

  • ncolors (int) – Number of colors in the colormap to be used.

  • clip (bool, optional) –

    If clip is True, out of range values are mapped to 0 if they are below boundaries[0] or mapped to ncolors - 1 if they are above boundaries[-1].

    If clip is False, out of range values are mapped to -1 if they are below boundaries[0] or mapped to ncolors if they are above boundaries[-1]. These are then converted to valid indices by Colormap.__call__.

  • extend ({'neither', 'both', 'min', 'max'}, default: 'neither') – Extend the number of bins to include one or both of the regions beyond the boundaries. For example, if extend is ‘min’, then the color to which the region between the first pair of boundaries is mapped will be distinct from the first color in the colormap, and by default a ~matplotlib.colorbar.Colorbar will be drawn with the triangle extension on the left or lower end.

Notes

If there are fewer bins (including extensions) than colors, then the color index is chosen by linearly interpolating the [0, nbins - 1] range onto the [0, ncolors - 1] range, effectively skipping some colors in the middle of the colormap.

inverse(value)#
Raises:

ValueError – BoundaryNorm is not invertible, so calling this method will always raise an error