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.DiscreteColormap.html below:

DiscreteColormap — UltraPlot documentation

UltraPlot DiscreteColormap
class DiscreteColormap(colors, name=None, N=None, alpha=None, **kwargs)[source]

Bases: ListedColormap, _Colormap

Replacement for ListedColormap.

Parameters:
  • colors (sequence of color-spec, optional) – The colormap colors.

  • name (str, default: '_no_name') – The colormap name.

  • N (int, default: len(colors)) – The number of levels. The color list is truncated or wrapped to match this length.

  • alpha (float, optional) – The opacity for the colormap colors. This overrides the input color opacities.

Other Parameters:

**kwargs – Passed to ListedColormap.

Methods Summary

append(*args[, name, N])

Append arbitrary colormaps onto this colormap.

concatenate(*[, new_obj, message])

copy([colors, name, N, alpha])

Return a new colormap with relevant properties copied from this one if they were not provided as keyword arguments.

from_file(path, *[, warn_on_failure])

Load color cycle from a file.

reversed([name])

Return a reversed version of the colormap.

save([path, alpha])

Save the colormap data to a file.

set_alpha(alpha)

Set the opacity for the entire colormap.

shifted([shift, name])

Return a cyclically shifted version of the colormap.

truncate([left, right, name])

Return a truncated version of the colormap.

truncated(*[, new_obj, message])

updated(*[, new_obj, message])

Methods Documentation

append(*args, name=None, N=None, **kwargs)[source]

Append arbitrary colormaps onto this colormap.

Parameters:
  • *args – Instances of DiscreteColormap.

  • name (str, optional) – The new colormap name. Default is to merge each name with underscores and prepend a leading underscore, for example _name1_name2.

  • N (int, optional) – The number of points in the colormap lookup table. Default is the number of colors in the concatenated lists.

Other Parameters:

**kwargs – Passed to copy.

concatenate(*, new_obj=<function DiscreteColormap.append>, message="'concatenate' was deprecated in version 0.6.0 and may be removed in the next major release (version 2.0.0). Please use 'append' instead.", **kwargs)
copy(colors=None, name=None, N=None, *, alpha=None)[source]

Return a new colormap with relevant properties copied from this one if they were not provided as keyword arguments.

Parameters:
  • name (str, default: '_name_copy') – The new colormap name.

  • colors, N, alpha (optional) – See DiscreteColormap. If not provided, these are copied from the current colormap.

classmethod from_file(path, *, warn_on_failure=False)[source]

Load color cycle from a file.

Parameters:
  • path (path-like) – The file path. Valid file extensions are shown in the below table.

    Extension

    Description

    .hex

    Comma-delimited list of HEX strings.

    .rgb, .txt

    3-4 column table of channel values.

  • warn_on_failure (bool, optional) – If True, issue a warning when loading fails instead of raising an error.

reversed(name=None, **kwargs)[source]

Return a reversed version of the colormap.

Parameters:

name (str, default: '_name_r') – The new colormap name.

Other Parameters:

**kwargs – Passed to DiscreteColormap.copy

save(path=None, alpha=True)[source]

Save the colormap data to a file.

Parameters:
  • path (path-like, optional) – The output filename. If not provided, the colormap is saved in the cycles subfolder in user_folder() under the filename name.hex (where name is the color cycle name). Valid extensions are described in the below table.

    Extension

    Description

    .hex

    Comma-delimited list of HEX strings.

    .rgb, .txt

    3-4 column table of channel values.

  • alpha (bool, optional) – Whether to include an opacity column for .rgb and .txt files.

set_alpha(alpha)[source]

Set the opacity for the entire colormap.

Parameters:

alpha (float) – The opacity.

shifted(shift=1, name=None)[source]

Return a cyclically shifted version of the colormap.

Parameters:
  • shift (float, default: 1) – The number of list indices to shift.

  • name (str, eefault: '_name_s') – The new colormap name.

truncate(left=None, right=None, name=None)[source]

Return a truncated version of the colormap.

Parameters:
  • left (float, default: None) – The colormap index for the new “leftmost” color. Must fall between 0 and self.N. For example, left=2 drops the first two colors.

  • right (float, default: None) – The colormap index for the new “rightmost” color. Must fall between 0 and self.N. For example, right=4 keeps the first four colors.

  • name (str, default: '_name_copy') – The new colormap name.

truncated(*, new_obj=<function DiscreteColormap.truncate>, message="'truncated' was deprecated in version 0.6.0 and may be removed in the next major release (version 2.0.0). Please use 'truncate' instead.", **kwargs)
updated(*, new_obj=<function DiscreteColormap.copy>, message="'updated' was deprecated in version 0.6.0 and may be removed in the next major release (version 2.0.0). Please use 'copy' instead.", **kwargs)

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