psy_simple.plugin module

psy-simple psyplot plugin

This module defines the rcParams for the psy-simple plugin.

Classes:

BoundsMethod(value)

An enumeration.

BoundsType(method[, N, percmin, percmax, ...])

BoundsValidator(type[, default, ...])

For parameter description see matplotlib.rcsetup.ValidateInStrings.

CTicksMethod(value)

An enumeration.

CTicksType(method[, N, percmin, percmax, ...])

DictValValidator(key, valid, validators, default)

A validation class for formatoptions that expect dictionaries as values

LineWidthValidator(key, valid[, ignorecase, ...])

valid is a list of legal strings.

TicksMethod(value)

An enumeration.

TicksType(method[, N, percmin, percmax, ...])

TicksValidator(key, valid[, ignorecase, ...])

valid is a list of legal strings.

ValidateList([dtype, length, listtype])

Validate a list of the specified dtype

strEnum(value)

An enumeration.

Functions:

get_versions([requirements])

patch_prior_1_0(plotter_d, versions)

Patch psy_simple plotters for versions smaller than 1.0

try_and_error(*funcs)

Apply multiple validation functions

validate_alpha(val)

Validate an alpha value between 0 and 1

validate_axiscolor(value)

Validate a dictionary containing axiscolor definitions

validate_bool_maybe_none(value)

validate_cbarpos(value)

Validate a colorbar position

validate_cmap(val)

Validate a colormap

validate_cmaps(cmaps)

Validate a dictionary of color lists

validate_dataarray(val)

validate_err_calc(val)

Validation function for the psy_simple.plotter.FldmeanPlotter.err_calc formatoption

validate_float(s)

convert s to float or raise

validate_fontweight(value)

validate_iter(value)

Validate that the given value is an iterable

validate_legend(value)

validate_limits(value)

validate_lineplot(value)

Validate the value for the LinePlotter.plot formatoption

validate_marker(val)

Does not really make a validation because markers can be quite of different types

validate_none(b)

Validate that None is given

validate_plot(val)

validate_str(s)

Validate a string

validate_sym_lims(val)

validate_text(value)

Validate a text formatoption

validate_ticklabels(value)

Data:

patches

patches to apply when loading a project

class psy_simple.plugin.BoundsMethod(value)

Bases: psy_simple.plugin.strEnum

An enumeration.

Attributes:

data

log

mid

minmax

rounded

roundedsym

sym

symlog

data = 'data'
log = 'log'
mid = 'mid'
minmax = 'minmax'
rounded = 'rounded'
roundedsym = 'roundedsym'
sym = 'sym'
symlog = 'symlog'
class psy_simple.plugin.BoundsType(method: psy_simple.plugin.BoundsMethod, N: int = None, percmin: float = 0, percmax: float = 100, vmin: float = None, vmax: float = None)[source]

Bases: object

Attributes:

N

method

percmax

percmin

vmax

vmin

N: int = None
method: psy_simple.plugin.BoundsMethod
percmax: float = 100
percmin: float = 0
vmax: float = None
vmin: float = None
class psy_simple.plugin.BoundsValidator(type, default='rounded', possible_instances=None)[source]

Bases: object

For parameter description see matplotlib.rcsetup.ValidateInStrings.

Parameters
  • inis (tuple) – Tuple of object types that may pass the check

  • default (str) – The default string to use for an integer (Default: ‘rounded’)

Methods:

instance_check(val)

instance_check(val)[source]
class psy_simple.plugin.CTicksMethod(value)

Bases: psy_simple.plugin.strEnum

An enumeration.

Attributes:

bounds

data

log

mid

midbounds

minmax

rounded

roundedsym

sym

symlog

bounds = 'bounds'
data = 'data'
log = 'log'
mid = 'mid'
midbounds = 'midbounds'
minmax = 'minmax'
rounded = 'rounded'
roundedsym = 'roundedsym'
sym = 'sym'
symlog = 'symlog'
class psy_simple.plugin.CTicksType(method: psy_simple.plugin.CTicksMethod, N: int = None, percmin: float = 0, percmax: float = 100, vmin: float = None, vmax: float = None)[source]

Bases: psy_simple.plugin.BoundsType

Attributes:

method

method: psy_simple.plugin.CTicksMethod
class psy_simple.plugin.DictValValidator(key, valid, validators, default, ignorecase=False)[source]

Bases: object

A validation class for formatoptions that expect dictionaries as values

Parameters
  • key (str) – The name of the formatoption (will be used for error handling)

  • valid (list of str) – The valid keys for the dictionary

  • validators (func) – The validation function for the values of the dictionary

  • default (object) – The default value to use if a key from valid is given in the provided value

  • ignorecase (bool) – Whether the case of the keys should be ignored

class psy_simple.plugin.LineWidthValidator(key, valid, ignorecase=False, *, _deprecated_since=None)[source]

Bases: matplotlib.rcsetup.ValidateInStrings

valid is a list of legal strings.

class psy_simple.plugin.TicksMethod(value)

Bases: psy_simple.plugin.strEnum

An enumeration.

Attributes:

data

day

hour

log

mid

minmax

month

monthbegin

monthend

rounded

roundedsym

sym

symlog

week

year

yearbegin

yearend

data = 'data'
day = 'day'
hour = 'hour'
log = 'log'
mid = 'mid'
minmax = 'minmax'
month = 'month'
monthbegin = 'monthbegin'
monthend = 'monthend'
rounded = 'rounded'
roundedsym = 'roundedsym'
sym = 'sym'
symlog = 'symlog'
week = 'week'
year = 'year'
yearbegin = 'yearbegin'
yearend = 'yearend'
class psy_simple.plugin.TicksType(method: psy_simple.plugin.TicksMethod, N: int = None, percmin: float = 0, percmax: float = 100, vmin: float = None, vmax: float = None)[source]

Bases: psy_simple.plugin.BoundsType

Attributes:

method

method: psy_simple.plugin.TicksMethod
class psy_simple.plugin.TicksValidator(key, valid, ignorecase=False, *, _deprecated_since=None)[source]

Bases: matplotlib.rcsetup.ValidateInStrings

valid is a list of legal strings.

class psy_simple.plugin.ValidateList(dtype=None, length=None, listtype=<class 'list'>)[source]

Bases: object

Validate a list of the specified dtype

Parameters
  • dtype (object) – A datatype (e.g. float) that shall be used for the conversion

  • length (int) – The expected length of the list

  • listtype (type) – The type to use for creating the list. Should accept any iterable

Attributes:

dtype

data type (e.g.

dtype

data type (e.g. float) used for the conversion

psy_simple.plugin.get_versions(requirements=True)[source]
psy_simple.plugin.patch_prior_1_0(plotter_d, versions)[source]

Patch psy_simple plotters for versions smaller than 1.0

Before psyplot 1.0.0, the plotters in the psy_simple package where part of the psyplot.plotter.simple module. This has to be corrected

psy_simple.plugin.patches = {('psyplot.plotter.simple', 'BarPlotter'): <function patch_prior_1_0>, ('psyplot.plotter.simple', 'CombinedSimplePlotter'): <function patch_prior_1_0>, ('psyplot.plotter.simple', 'DensityPlotter'): <function patch_prior_1_0>, ('psyplot.plotter.simple', 'DensityRegPlotter'): <function patch_prior_1_0>, ('psyplot.plotter.simple', 'LinRegPlotter'): <function patch_prior_1_0>, ('psyplot.plotter.simple', 'LinePlotter'): <function patch_prior_1_0>, ('psyplot.plotter.simple', 'Simple2DPlotter'): <function patch_prior_1_0>, ('psyplot.plotter.simple', 'SimplePlotterBase'): <function patch_prior_1_0>, ('psyplot.plotter.simple', 'SimpleVectorPlotter'): <function patch_prior_1_0>, ('psyplot.plotter.simple', 'ViolinPlotter'): <function patch_prior_1_0>}

patches to apply when loading a project

psy_simple.plugin.rcParams

the RcParams for the psy-simple plugin

class psy_simple.plugin.strEnum(value)[source]

Bases: str, enum.Enum

An enumeration.

psy_simple.plugin.try_and_error(*funcs)[source]

Apply multiple validation functions

Parameters

*funcs – Validation functions to test

Return type

function

psy_simple.plugin.validate_alpha(val)[source]

Validate an alpha value between 0 and 1

psy_simple.plugin.validate_axiscolor(value)[source]

Validate a dictionary containing axiscolor definitions

Parameters

value (dict) – see psyplot.plotter.baseplotter.axiscolor

Return type

dict

Raises

ValueError

psy_simple.plugin.validate_bool_maybe_none(value)
psy_simple.plugin.validate_cbarpos(value)[source]

Validate a colorbar position

Parameters

value (bool or str) – A string can be a combination of ‘sh|sv|fl|fr|ft|fb|b|r’

Returns

list of strings with possible colorbar positions

Return type

list

Raises

ValueError

psy_simple.plugin.validate_cmap(val)[source]

Validate a colormap

Parameters

val (str or mpl.colors.Colormap) –

Return type

str or mpl.colors.Colormap

Raises

ValueError

psy_simple.plugin.validate_cmaps(cmaps)[source]

Validate a dictionary of color lists

Parameters

cmaps (dict) – a mapping from a colormap name to a list of colors

Raises

ValueError – If one of the values in cmaps is not a color list

Notes

For all items (listname, list) in cmaps, the reversed list is automatically inserted with the listname + '_r' key.

psy_simple.plugin.validate_dataarray(val)[source]
psy_simple.plugin.validate_err_calc(val)[source]

Validation function for the psy_simple.plotter.FldmeanPlotter.err_calc formatoption

psy_simple.plugin.validate_float(s)[source]

convert s to float or raise

Returns

s converted to a float

Return type

float

Raises

ValueError

psy_simple.plugin.validate_fontweight(value)[source]
psy_simple.plugin.validate_iter(value)[source]

Validate that the given value is an iterable

psy_simple.plugin.validate_legend(value)[source]
psy_simple.plugin.validate_limits(value)[source]
psy_simple.plugin.validate_lineplot(value)[source]

Validate the value for the LinePlotter.plot formatoption

Parameters

value (None, str or list with mixture of both) – The value to validate

psy_simple.plugin.validate_marker(val)[source]

Does not really make a validation because markers can be quite of different types

psy_simple.plugin.validate_none(b)[source]

Validate that None is given

Parameters

b ({None, 'none'}) – None or string (the case is ignored)

Return type

None

Raises

ValueError

psy_simple.plugin.validate_plot(val)[source]
psy_simple.plugin.validate_str(s)[source]

Validate a string

Parameters

s (str) –

Return type

str

Raises

ValueError

psy_simple.plugin.validate_sym_lims(val)[source]
psy_simple.plugin.validate_text(value)[source]

Validate a text formatoption

Parameters

value (see psyplot.plotter.labelplotter.text) –

Raises

ValueError

psy_simple.plugin.validate_ticklabels(value)