A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://ultraplot.readthedocs.io/en/latest/api/ultraplot.colors.SegmentedNorm.html below:

SegmentedNorm — UltraPlot documentation

UltraPlot SegmentedNorm
class SegmentedNorm(levels, vmin=None, vmax=None, clip=False)[source]

Bases: Normalize

Normalizer that scales data linearly with respect to the interpolated index in an arbitrary monotonic level sequence.

Parameters:
  • levels (sequence of float) – The level boundaries. Must be monotonically increasing or decreasing.

  • vmin (float, optional) – Ignored but included for consistency with other normalizers. Set to the minimum of levels.

  • vmax (float, optional) – Ignored but included for consistency with other normalizers. Set to the minimum of levels.

  • clip (bool, optional) – Whether to clip values falling outside of the minimum and maximum of levels.

Note

The algorithm this normalizer uses to select normalized values in-between level list indices is adapted from the algorithm LinearSegmentedColormap uses to select channel values in-between segment data points (hence the name SegmentedNorm).

Example

In the below example, unevenly spaced levels are passed to contourf, resulting in the automatic application of SegmentedNorm.

>>> import ultraplot as uplt
>>> import numpy as np
>>> levels = [1, 2, 5, 10, 20, 50, 100, 200, 500, 1000]
>>> data = 10 ** (3 * np.random.rand(10, 10))
>>> fig, ax = uplt.subplots()
>>> ax.contourf(data, levels=levels)

Methods Summary

Methods Documentation

__call__(value, clip=None)[source]

Normalize the data values to 0-1. Inverse of inverse.

Parameters:
  • value (numeric) – The data to be normalized.

  • clip (bool, default: self.clip) – Whether to clip values falling outside of the minimum and maximum levels.

inverse(value)[source]

Inverse of __call__.

Parameters:

value (numeric) – The data to be un-normalized.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4