Module for color specific widgets

This module corresponds to the psy_simple.colors module as a version for the usage in the psyplot GUI.

Classes:

ArrayFmtWidget(parent[, array])

Fmt widget for psy_simple.plotters.DataTicksCalculator

BackGroundColorWidget(parent, fmto, project)

The widget to select the axes background color

BoundsFmtWidget(parent, fmto, project[, ...])

The widget for modifying the psy_simple.plotters.Bounds fmt

CMapFmtWidget(parent, fmto, project[, ...])

The widget for modifying the psy_simple.plotters.CMap fmt

CTicksFmtWidget(parent, fmto, project[, ...])

The formatoptions widget for the colorbar ticks.

CmapButton([cmaps, current])

A button with a dropdown menu to select colormaps

ColorLabel([color])

A QTableWidget with one cell and no headers to just display a color

ColormapDialog([names, N, editable])

A widget for selecting a colormap

ColormapModel([names, N])

A model for displaying colormaps

ColormapTable([names, N, editable])

A table for displaying colormaps

DataTicksCalculatorFmtWidget(parent[, ...])

Fmt widget for psy_simple.plotters.DataTicksCalculator

HighlightWidget

NormalizationWidget(parent, norm)

A simple widget representing a boundary norm

Functions:

create_cmap_thumb(cmap[, output])

class psy_simple.widgets.colors.ArrayFmtWidget(parent, array=None)

Bases: QWidget

Fmt widget for psy_simple.plotters.DataTicksCalculator

This formatoption widgets contains 3 line edits, one for the minimum, one for the maximum and one for the step size. And a spin box for the number of increments

Methods:

get_decimals(vmin, vmax)

set_array(*args, **kwargs)

set_obj()

toggle_txt_step(s)

static get_decimals(vmin, vmax)
set_array(*args, **kwargs)
set_obj()
toggle_txt_step(s)
class psy_simple.widgets.colors.BackGroundColorWidget(parent, fmto, project)

Bases: QWidget

The widget to select the axes background color

Methods:

set_color(color)

set_transparent()

toggle_color_button()

set_color(color)
set_transparent()
toggle_color_button()
class psy_simple.widgets.colors.BoundsFmtWidget(parent, fmto, project, properties=True)

Bases: QWidget

The widget for modifying the psy_simple.plotters.Bounds fmt

Methods:

block_widgets(*widgets)

get_auto_discrete_array_widget()

get_discrete_array_widget()

get_norm_widget(norm)

refresh_current_widget()

refresh_methods(text)

set_obj(obj)

set_value(value)

Attributes:

current_widget

default_args

default_kws

methods

norm_map

Classes:

methods_type

alias of BoundsType

block_widgets(*widgets)
current_widget = None
default_args = {'power-law': [1.0], 'symlog': [0.001]}
default_kws = {'symlog': {'base': 10}}
get_auto_discrete_array_widget()
get_discrete_array_widget()
get_norm_widget(norm)
methods = ['Discrete', 'Continuous']
methods_type

alias of BoundsType Attributes:

N

method

percmax

percmin

vmax

vmin

norm_map = {'No normalization': <class 'matplotlib.colors.Normalize'>, 'log': <class 'matplotlib.colors.LogNorm'>, 'power-law': <class 'matplotlib.colors.PowerNorm'>, 'symlog': <class 'matplotlib.colors.SymLogNorm'>}
refresh_current_widget()
refresh_methods(text)
set_obj(obj)
set_value(value)
class psy_simple.widgets.colors.CMapFmtWidget(parent, fmto, project, properties=True)

Bases: QWidget

The widget for modifying the psy_simple.plotters.CMap fmt

Methods:

choose_cmap([cmap])

edit_cmap()

invert_cmap()

refresh_cb_invert(obj)

set_obj(obj)

choose_cmap(cmap=None)
edit_cmap()
invert_cmap()
refresh_cb_invert(obj)
set_obj(obj)
class psy_simple.widgets.colors.CTicksFmtWidget(parent, fmto, project, properties=True)

Bases: BoundsFmtWidget

The formatoptions widget for the colorbar ticks.

Attributes:

auto_val

methods

norm_map

Classes:

methods_type

alias of CTicksType

Methods:

refresh_current_widget()

refresh_methods(text)

set_value(value)

auto_val = None
methods = ['Discrete', 'Auto']
methods_type

alias of CTicksType Attributes:

method

norm_map = {}
refresh_current_widget()
refresh_methods(text)
set_value(value)
class psy_simple.widgets.colors.CmapButton(cmaps=None, current=None, *args, **kwargs)

Bases: QToolButton

A button with a dropdown menu to select colormaps

Attributes:

colormap_changed(*args, **kwargs)

Methods:

open_cmap_dialog([N])

set_cmap(cmap)

setup_cmap_menu()

colormap_changed(*args, **kwargs)
open_cmap_dialog(N=10)
set_cmap(cmap)
setup_cmap_menu()
class psy_simple.widgets.colors.ColorLabel(color='w', *args, **kwargs)

Bases: QTableWidget

A QTableWidget with one cell and no headers to just display a color

Methods:

adjust_height()

Adjust the height to match the row height

select_color(*args)

Select a color using PyQt5.QtWidgets.QColorDialog.getColor()

setEnabled(self, a0)

set_color(color)

Set the color of the label

sizeHint()

Reimplemented to use the rowHeight as height

Attributes:

color

QtCore.QColor.

color_changed(*args, **kwargs)

a signal that is emitted with an rgba color if the chosen color changes

adjust_height()

Adjust the height to match the row height

color = None

QtCore.QColor. The current color that is displayed

color_changed(*args, **kwargs)

a signal that is emitted with an rgba color if the chosen color changes

select_color(*args)

Select a color using PyQt5.QtWidgets.QColorDialog.getColor()

setEnabled(self, a0: bool)
set_color(color)

Set the color of the label

This method sets the given color as background color for the cell and emits the color_changed signal

Parameters:

color (object) – Either a QtGui.QColor object or a color that can be converted to RGBA using the matplotlib.colors.to_rgba() function

sizeHint()

Reimplemented to use the rowHeight as height

class psy_simple.widgets.colors.ColormapDialog(names=[], N=10, editable=True, *args, **kwargs)

Bases: QDialog

A widget for selecting a colormap

Methods:

get_colormap([names, N])

Open a ColormapDialog and get a colormap

show_colormap([names, N, show])

Show a colormap dialog

classmethod get_colormap(names=[], N=10, *args, **kwargs)

Open a ColormapDialog and get a colormap

Parameters:
  • ``*args

    Anything else that is passed to the ColormapDialog

  • **kwargs`` – Anything else that is passed to the ColormapDialog

Returns:

Either the name of a standard colormap available via psy_simple.colors.get_cmap() or a colormap

Return type:

str or matplotlib.colors.Colormap

classmethod show_colormap(names=[], N=10, show=True, *args, **kwargs)

Show a colormap dialog

Parameters:
  • *args (str or matplotlib.colors.Colormap) –

    If a colormap, it returned unchanged.

    Strings may be any valid colormap name suitable for the matplotlib.cm.get_cmap() function or one of the color lists defined in the ‘colors.cmaps’ key of the psyplot.rcParams dictionary (including their reversed color maps given via the ‘_r’ extension).

  • N (int, optional) – Default: 11. The number of increments in the colormap.

  • show (bool, optional) – Default: True. If True, show the created figure at the end with pyplot.show(block=False)

class psy_simple.widgets.colors.ColormapModel(names=[], N=10, *args, **kwargs)

Bases: QAbstractTableModel

A model for displaying colormaps

Methods:

columnCount(self[, parent])

data(index[, role])

Cell content

headerData(section, orientation[, role])

Set header data

reset()

rowCount(self[, parent])

set_colors([N, names])

columnCount(self, parent: QModelIndex = QModelIndex()) int
data(index, role=0)

Cell content

headerData(section, orientation, role=0)

Set header data

reset()
rowCount(self, parent: QModelIndex = QModelIndex()) int
set_colors(N=None, names=None)
class psy_simple.widgets.colors.ColormapTable(names=[], N=10, editable=True, *args, **kwargs)

Bases: QTableView

A table for displaying colormaps

Methods:

change_color(index)

columnCount()

rowCount()

setModel(self, model)

Attributes:

chosen_colormap

change_color(index)
property chosen_colormap
columnCount()
rowCount()
setModel(self, model: QAbstractItemModel | None)
class psy_simple.widgets.colors.DataTicksCalculatorFmtWidget(parent, method=None, methods_type=<class 'psy_simple.plugin.BoundsType'>)

Bases: QWidget

Fmt widget for psy_simple.plotters.DataTicksCalculator

This widget contains a combo box with the different options from the psy_simple.plotters.DataTicksCalculator.calc_funcs, a spin box for the number of increments and two text widgets for minimum and maximum percentile

Methods:

get_decimals(vmin, vmax)

refresh(method, fmto)

set_obj()

static get_decimals(vmin, vmax)
refresh(method, fmto)
set_obj()
class psy_simple.widgets.colors.HighlightWidget

Bases: QWidget

Methods:

enterEvent(self, a0)

leaveEvent(self, a0)

set_highlighted(b)

enterEvent(self, a0: QEvent | None)
leaveEvent(self, a0: QEvent | None)
set_highlighted(b)
class psy_simple.widgets.colors.NormalizationWidget(parent, norm)

Bases: QWidget

A simple widget representing a boundary norm

Methods:

fill_from_norm()

set_obj()

fill_from_norm()
set_obj()
psy_simple.widgets.colors.create_cmap_thumb(cmap, output=None)