wolfhece.PyPalette
Author: HECE - University of Liege, Pierre Archambeau Date: 2024
Copyright (c) 2024 University of Liege. All rights reserved.
This script and its content are protected by copyright law. Unauthorized copying or distribution of this file, via any medium, is strictly prohibited.
Module Contents
- class wolfhece.PyPalette.wolfpalette(parent=None, title=_('Colormap'), w=100, h=500, nseg=1024)[source]
Bases:
wx.Frame,matplotlib.colors.LinearSegmentedColormap
Color palette based on the “LinearSegmentedColormap” object from Matplotlib (Colormap objects based on lookup tables using linear segments)
- get_rgba(x: numpy.ndarray)[source]
Retrieve the color based on the value x
- Parameters:
x – array of values
- distribute_values(minval: float = -99999, maxval: float = -99999, step=0, wx_permitted=True)[source]
Distribution of the palette values
- Parameters:
minval – minimum value
maxval – maximum value
step – distribution step
If the step is provided, it takes precedence over the maximum value.
- export_image(fn='', h_or_v: Literal['h', 'v', ''] = '', figax=None)[source]
Export image from colormap
:param : fn : filepath or io.BytesIO() :param : h_or_v : configuration to save ‘h’ = horizontal, ‘v’ = vertical, ‘’ = both
- fillgrid(gridto: wolfhece.CpGrid.CpGrid)[source]
Fill a grid with the palette values
- updatefromgrid(gridfrom: wolfhece.CpGrid.CpGrid)[source]
Update the palette based on a grid
- updatefrompalette(srcpal)[source]
Update the palette based on another one
We copy the values, we do not point to the object
- set_values_colors(values: list[float] | numpy.ndarray, colors: list[tuple[int]] | numpy.ndarray | list[tuple[str]])[source]
Update the values and colors of the palette
- Parameters:
values – list or array of values
colors – list or array of colors (RGB or RGBA)
- set_discrete_values_colors(values: list[float] | numpy.ndarray, colors: list[tuple[int]] | numpy.ndarray | list[tuple[str]])[source]
Update the values and colors of the palette in discrete mode
- Parameters:
values – list or array of values
colors – list or array of colors (RGB or RGBA)
- set_linear_values_colors(values: list[float] | numpy.ndarray, colors: list[tuple[int]] | numpy.ndarray | list[tuple[str]])[source]
Update the values and colors of the palette in linear mode
- Parameters:
values – list or array of values
colors – list or array of colors (RGB or RGBA)
- isopop(array: numpy.ma.masked_array, nbnotnull: int = 99999)[source]
Remplissage des valeurs de palette sur base d’une équirépartition de valeurs
- defaultgray_minmax(array: numpy.ma.masked_array, nbnotnull=99999)[source]
Remplissage des valeurs de palette sur base d’une équirépartition de valeurs
- defaultblue_minmax(array: numpy.ma.masked_array, nbnotnull=99999)[source]
Remplissage des valeurs de palette sur base d’une équirépartition de valeurs