psy_simple.base module

Base formatoptions for psy-simple.

This module defines several formatoptions that are the basis for many matplotlib figures, such as axes title, figure title, etc.

Formatoption classes:

BackgroundColor(key[, plotter, ...])

The background color for the matplotlib axes.

Figtitle(key[, plotter, index_in_list, ...])

Plot a figure title

Mask(key[, plotter, index_in_list, ...])

Mask the data where a certain condition is True

MaskBetween(key[, plotter, index_in_list, ...])

Mask data points between two numbers

MaskGeq(key[, plotter, index_in_list, ...])

Mask data points greater than or equal to a number

MaskGreater(key[, plotter, index_in_list, ...])

Mask data points greater than a number

MaskLeq(key[, plotter, index_in_list, ...])

Mask data points smaller than or equal to a number

MaskLess(key[, plotter, index_in_list, ...])

Mask data points smaller than a number

Text(*args, **kwargs)

Add text anywhere on the plot

Tight(key[, plotter, index_in_list, ...])

Automatically adjust the plots.

Title(key[, plotter, index_in_list, ...])

Show the title

ValueMaskBase(key[, plotter, index_in_list, ...])

Base class for masking formatoptions

Plotter classes:

BasePlotter([data, ax, auto_update, ...])

Base class with formatoptions for plotting on an matplotlib axes

TitlesPlotter([data, ax, auto_update, ...])

Plotter class for labels

Classes:

TextBase()

Abstract base class for formatoptions that provides a replace method

Functions:

label_props(base[, label_name, children, ...])

Function that returns a Formatoption class for modifying the fontsite

label_size(base[, label_name, children, ...])

Function that returns a Formatoption class for modifying the fontsite

label_weight(base[, label_name, children, ...])

Function that returns a Formatoption class for modifying the fontweight

class psy_simple.base.BackgroundColor(key, plotter=None, index_in_list=None, additional_children=[], additional_dependencies=[], **kwargs)[source]

Bases: psyplot.plotter.Formatoption

The background color for the matplotlib axes.

Possible types

  • ‘rc’ – to use matplotlibs rc params

  • None – to use a transparent color

  • color – Any possible matplotlib color

Parameters
  • key (str) – formatoption key in the plotter

  • plotter (psyplot.plotter.Plotter) – Plotter instance that holds this formatoption. If None, it is assumed that this instance serves as a descriptor.

  • index_in_list (int or None) – The index that shall be used if the data is a psyplot.InteractiveList

  • additional_children (list or str) – Additional children to use (see the children attribute)

  • additional_dependencies (list or str) – Additional dependencies to use (see the dependencies attribute)

  • **kwargs – Further keywords may be used to specify different names for children, dependencies and connection formatoptions that match the setup of the plotter. Hence, keywords may be anything of the children, dependencies and connections attributes, with values being the name of the new formatoption in this plotter.

Methods:

get_fmt_widget(parent, project)

Get a widget to update the formatoption in the GUI

update(value)

Method that is call to update the formatoption on the axes

Attributes:

group

str.

name

str.

get_fmt_widget(parent, project)[source]

Get a widget to update the formatoption in the GUI

This method should return a QWidget that is loaded by the psyplot-gui when the formatoption is selected in the psyplot_gui.main.Mainwindow.fmt_widget. It should call the insert_text() method when the update text for the formatoption should be changed.

Parameters
Returns

The widget to control the formatoption

Return type

PyQt5.QtWidgets.QWidget

group = 'axes'

str. Key of the group name in groups of this formatoption keyword

name = 'Background color of the plot'

str. A bit more verbose name than the formatoption key to be included in the gui. If None, the key is used in the gui

update(value)[source]

Method that is call to update the formatoption on the axes

Parameters

value – Value to update

class psy_simple.base.BasePlotter(data=None, ax=None, auto_update=None, project=None, draw=False, make_plot=True, clear=False, enable_post=False, **kwargs)[source]

Bases: psy_simple.base.TitlesPlotter

Base class with formatoptions for plotting on an matplotlib axes

Parameters
  • data (InteractiveArray or ArrayList, optional) – Data object that shall be visualized. If given and plot is True, the initialize_plot() method is called at the end. Otherwise you can call this method later by yourself

  • ax (matplotlib.axes.Axes) – Matplotlib Axes to plot on. If None, a new one will be created as soon as the initialize_plot() method is called

  • auto_update (bool) – Default: None. A boolean indicating whether this list shall automatically update the contained arrays when calling the update() method or not. See also the no_auto_update attribute. If None, the value from the 'lists.auto_update' key in the psyplot.rcParams dictionary is used.

  • draw (bool or None) – Boolean to control whether the figure of this array shall be drawn at the end. If None, it defaults to the ‘auto_draw’` parameter in the psyplot.rcParams dictionary

  • make_plot (bool) – If True, and data is not None, the plot is initialized. Otherwise only the framework between plotter and data is set up

  • clear (bool) – If True, the axes is cleared first

  • enable_post (bool) – If True, the post formatoption is enabled and post processing scripts are allowed

  • **kwargs – Any formatoption key from the formatoptions attribute that shall be used

Axes formatoptions:

background

The background color for the matplotlib axes.

tight

Automatically adjust the plots.

Label formatoptions:

figtitle

Plot a figure title

figtitleprops

Properties of the figure title

figtitlesize

Set the size of the figure title

figtitleweight

Set the fontweight of the figure title

text

Add text anywhere on the plot

title

Show the title

titleprops

Properties of the title

titlesize

Set the size of the title

titleweight

Set the fontweight of the title

Masking formatoptions:

mask

Mask the data where a certain condition is True

maskbetween

Mask data points between two numbers

maskgeq

Mask data points greater than or equal to a number

maskgreater

Mask data points greater than a number

maskleq

Mask data points smaller than or equal to a number

maskless

Mask data points smaller than a number

Post processing formatoptions:

post

Apply your own postprocessing script

post_timing

Determine when to run the post formatoption

background

The background color for the matplotlib axes.

Possible types

  • ‘rc’ – to use matplotlibs rc params

  • None – to use a transparent color

  • color – Any possible matplotlib color

figtitle

Plot a figure title

Set the title of the figure. You can insert any meta key from the xarray.DataArray.attrs via a string like '%(key)s'. Furthermore there are some special cases:

  • Strings like '%Y', '%b', etc. will be replaced using the datetime.datetime.strftime() method as long as the data has a time coordinate and this can be converted to a datetime object.

  • '%(x)s', '%(y)s', '%(z)s', '%(t)s' will be replaced by the value of the x-, y-, z- or time coordinate (as long as this coordinate is one-dimensional in the data)

  • any attribute of one of the above coordinates is inserted via axis + key (e.g. the name of the x-coordinate can be inserted via '%(xname)s').

  • Labels defined in the psyplot.rcParams 'texts.labels' key are also replaced when enclosed by ‘{}’. The standard labels are

    • tinfo: %H:%M

    • dtinfo: %B %d, %Y. %H:%M

    • dinfo: %B %d, %Y

    • desc: %(long_name)s [%(units)s]

    • sdesc: %(name)s [%(units)s]

Possible types

str – The title for the suptitle() function

Notes

  • If the plotter is part of a psyplot.project.Project and multiple plotters of this project are on the same figure, the replacement attributes (see above) are joined by a delimiter. If the delimiter attribute of this Figtitle instance is not None, it will be used. Otherwise the rcParams[‘texts.delimiter’] item is used.

  • This is the title of the whole figure! For the title of this specific subplot, see the title formatoption.

figtitleprops

Properties of the figure title

Specify the font properties of the figure title manually.

Possible types

dict – Items may be any valid text property

figtitlesize

Set the size of the figure title

Possible types

  • float – The absolute font size in points (e.g., 12)

  • string – Strings might be ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’.

figtitleweight

Set the fontweight of the figure title

Possible types

  • float – a float between 0 and 1000

  • string – Possible strings are one of ‘ultralight’, ‘light’, ‘normal’, ‘regular’, ‘book’, ‘medium’, ‘roman’, ‘semibold’, ‘demibold’, ‘demi’, ‘bold’, ‘heavy’, ‘extra bold’, ‘black’.

mask

Mask the data where a certain condition is True

This formatoption can be used to mask the plotting data based on another array. This array can be the name of a variable in the base dataset, or it can be a numeric array. Note that the data needs to be on exactly the same coordinates as the data shown here

Possible types

  • None – Apply no mask

  • str – The name of a variable in the base dataset to use.

    • dimensions that are in the given mask but not in the visualized base variable will be aggregated using numpy.any()

    • if the given mask misses dimensions that are in the visualized data (i.e. the data of this plotter), we broadcast the mask to match the shape of the data

    • dimensions that are in mask and the base variable, but not in the visualized data will be matched against each other

  • str – The path to a netCDF file that shall be loaded

  • xr.DataArray or np.ndarray – An array that can be broadcasted to the shape of the data

maskbetween

Mask data points between two numbers

Possible types

float – The floating number to mask above

maskgeq

Mask data points greater than or equal to a number

Possible types

float – The floating number to mask above

maskgreater

Mask data points greater than a number

Possible types

float – The floating number to mask above

maskleq

Mask data points smaller than or equal to a number

Possible types

float – The floating number to mask below

maskless

Mask data points smaller than a number

Possible types

float – The floating number to mask below

post

Apply your own postprocessing script

This formatoption let’s you apply your own post processing script. Just enter the script as a string and it will be executed. The formatoption will be made available via the self variable

Possible types

  • None – Don’t do anything

  • str – The post processing script as string

Note

This formatoption uses the built-in exec() function to compile the script. Since this poses a security risk when loading psyplot projects, it is by default disabled through the Plotter.enable_post attribute. If you are sure that you can trust the script in this formatoption, set this attribute of the corresponding Plotter to True

Examples

Assume, you want to manually add the mean of the data to the title of the matplotlib axes. You can simply do this via

from psyplot.plotter import Plotter
from xarray import DataArray
plotter = Plotter(DataArray([1, 2, 3]))
# enable the post formatoption
plotter.enable_post = True
plotter.update(post="self.ax.set_title(str(self.data.mean()))")
plotter.ax.get_title()
'2.0'

By default, the post formatoption is only ran, when it is explicitly updated. However, you can use the post_timing formatoption, to run it automatically. E.g. for running it after every update of the plotter, you can set

plotter.update(post_timing='always')

See also

post_timing

Determine the timing of this formatoption

post_timing

Determine when to run the post formatoption

This formatoption determines, whether the post formatoption should be run never, after replot or after every update.

Possible types

  • ‘never’ – Never run post processing scripts

  • ‘always’ – Always run post processing scripts

  • ‘replot’ – Only run post processing scripts when the data changes or a replot is necessary

See also

post

The post processing formatoption

text

Add text anywhere on the plot

This formatoption draws a text on the specified position on the figure. You can insert any meta key from the xarray.DataArray.attrs via a string like '%(key)s'. Furthermore there are some special cases:

  • Strings like '%Y', '%b', etc. will be replaced using the datetime.datetime.strftime() method as long as the data has a time coordinate and this can be converted to a datetime object.

  • '%(x)s', '%(y)s', '%(z)s', '%(t)s' will be replaced by the value of the x-, y-, z- or time coordinate (as long as this coordinate is one-dimensional in the data)

  • any attribute of one of the above coordinates is inserted via axis + key (e.g. the name of the x-coordinate can be inserted via '%(xname)s').

  • Labels defined in the psyplot.rcParams 'texts.labels' key are also replaced when enclosed by ‘{}’. The standard labels are

    • tinfo: %H:%M

    • dtinfo: %B %d, %Y. %H:%M

    • dinfo: %B %d, %Y

    • desc: %(long_name)s [%(units)s]

    • sdesc: %(name)s [%(units)s]

Possible types

  • str – If string s: this will be used as (1., 1., s, {‘ha’: ‘right’}) (i.e. a string in the upper right corner of the axes).

  • tuple or list of tuples (x,y,s[,coord.-system][,options]]) – Each tuple defines a text instance on the plot. 0<=x, y<=1 are the coordinates. The coord.-system can be either the data coordinates (default, 'data') or the axes coordinates ('axes') or the figure coordinates (‘fig’). The string s finally is the text. options may be a dictionary to specify format the appearence (e.g. 'color', 'fontweight', 'fontsize', etc., see matplotlib.text.Text for possible keys). To remove one single text from the plot, set (x,y,’’[, coord.-system]) for the text at position (x,y)

  • empty list – remove all texts from the plot

See also

title, figtitle

tight

Automatically adjust the plots.

If set to True, the plots are automatically adjusted to fit to the figure limitations via the matplotlib.pyplot.tight_layout() function.

Possible types

bool – True for automatic adjustment

Warning

There is no update method to undo what happend after this formatoption is set to True!

title

Show the title

Set the title of the plot. You can insert any meta key from the xarray.DataArray.attrs via a string like '%(key)s'. Furthermore there are some special cases:

  • Strings like '%Y', '%b', etc. will be replaced using the datetime.datetime.strftime() method as long as the data has a time coordinate and this can be converted to a datetime object.

  • '%(x)s', '%(y)s', '%(z)s', '%(t)s' will be replaced by the value of the x-, y-, z- or time coordinate (as long as this coordinate is one-dimensional in the data)

  • any attribute of one of the above coordinates is inserted via axis + key (e.g. the name of the x-coordinate can be inserted via '%(xname)s').

  • Labels defined in the psyplot.rcParams 'texts.labels' key are also replaced when enclosed by ‘{}’. The standard labels are

    • tinfo: %H:%M

    • dtinfo: %B %d, %Y. %H:%M

    • dinfo: %B %d, %Y

    • desc: %(long_name)s [%(units)s]

    • sdesc: %(name)s [%(units)s]

Possible types

str – The title for the title() function.

Notes

This is the title of this specific subplot! For the title of the whole figure, see the figtitle formatoption.

titleprops

Properties of the title

Specify the font properties of the figure title manually.

Possible types

dict – Items may be any valid text property

titlesize

Set the size of the title

Possible types

  • float – The absolute font size in points (e.g., 12)

  • string – Strings might be ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’.

titleweight

Set the fontweight of the title

Possible types

  • float – a float between 0 and 1000

  • string – Possible strings are one of ‘ultralight’, ‘light’, ‘normal’, ‘regular’, ‘book’, ‘medium’, ‘roman’, ‘semibold’, ‘demibold’, ‘demi’, ‘bold’, ‘heavy’, ‘extra bold’, ‘black’.

class psy_simple.base.Figtitle(key, plotter=None, index_in_list=None, additional_children=[], additional_dependencies=[], **kwargs)[source]

Bases: psy_simple.base.TextBase, psyplot.plotter.Formatoption

Plot a figure title

Set the title of the figure. You can insert any meta key from the xarray.DataArray.attrs via a string like '%(key)s'. Furthermore there are some special cases:

  • Strings like '%Y', '%b', etc. will be replaced using the datetime.datetime.strftime() method as long as the data has a time coordinate and this can be converted to a datetime object.

  • '%(x)s', '%(y)s', '%(z)s', '%(t)s' will be replaced by the value of the x-, y-, z- or time coordinate (as long as this coordinate is one-dimensional in the data)

  • any attribute of one of the above coordinates is inserted via axis + key (e.g. the name of the x-coordinate can be inserted via '%(xname)s').

  • Labels defined in the psyplot.rcParams 'texts.labels' key are also replaced when enclosed by ‘{}’. The standard labels are

    • tinfo: %H:%M

    • dtinfo: %B %d, %Y. %H:%M

    • dinfo: %B %d, %Y

    • desc: %(long_name)s [%(units)s]

    • sdesc: %(name)s [%(units)s]

Possible types

str – The title for the suptitle() function

Notes

  • If the plotter is part of a psyplot.project.Project and multiple plotters of this project are on the same figure, the replacement attributes (see above) are joined by a delimiter. If the delimiter attribute of this Figtitle instance is not None, it will be used. Otherwise the rcParams[‘texts.delimiter’] item is used.

  • This is the title of the whole figure! For the title of this specific subplot, see the title formatoption.

See also

title, figtitlesize, figtitleweight, figtitleprops

Parameters
  • key (str) – formatoption key in the plotter

  • plotter (psyplot.plotter.Plotter) – Plotter instance that holds this formatoption. If None, it is assumed that this instance serves as a descriptor.

  • index_in_list (int or None) – The index that shall be used if the data is a psyplot.InteractiveList

  • additional_children (list or str) – Additional children to use (see the children attribute)

  • additional_dependencies (list or str) – Additional dependencies to use (see the dependencies attribute)

  • **kwargs – Further keywords may be used to specify different names for children, dependencies and connection formatoptions that match the setup of the plotter. Hence, keywords may be anything of the children, dependencies and connections attributes, with values being the name of the new formatoption in this plotter.

Methods:

clear_other_texts([remove])

Make sure that no other text is a the same position as this one

initialize_plot(s)

Method that is called when the plot is made the first time

update(s)

Method that is call to update the formatoption on the axes

Attributes:

enhanced_attrs

The enhanced attributes of the array

name

str.

clear_other_texts(remove=False)[source]

Make sure that no other text is a the same position as this one

This method clears all text instances in the figure that are at the same position as the _text attribute

Parameters

remove (bool) – If True, the Text instances are permanently deleted from the figure, otherwise there text is simply set to ‘’

property enhanced_attrs

The enhanced attributes of the array

initialize_plot(s)[source]

Method that is called when the plot is made the first time

Parameters

value – The value to use for the initialization

name = 'Figure title'

str. A bit more verbose name than the formatoption key to be included in the gui. If None, the key is used in the gui

update(s)[source]

Method that is call to update the formatoption on the axes

Parameters

value – Value to update

class psy_simple.base.Mask(key, plotter=None, index_in_list=None, additional_children=[], additional_dependencies=[], **kwargs)[source]

Bases: psyplot.plotter.Formatoption

Mask the data where a certain condition is True

This formatoption can be used to mask the plotting data based on another array. This array can be the name of a variable in the base dataset, or it can be a numeric array. Note that the data needs to be on exactly the same coordinates as the data shown here

Possible types

  • None – Apply no mask

  • str – The name of a variable in the base dataset to use.

    • dimensions that are in the given mask but not in the visualized base variable will be aggregated using numpy.any()

    • if the given mask misses dimensions that are in the visualized data (i.e. the data of this plotter), we broadcast the mask to match the shape of the data

    • dimensions that are in mask and the base variable, but not in the visualized data will be matched against each other

  • str – The path to a netCDF file that shall be loaded

  • xr.DataArray or np.ndarray – An array that can be broadcasted to the shape of the data

Parameters
  • key (str) – formatoption key in the plotter

  • plotter (psyplot.plotter.Plotter) – Plotter instance that holds this formatoption. If None, it is assumed that this instance serves as a descriptor.

  • index_in_list (int or None) – The index that shall be used if the data is a psyplot.InteractiveList

  • additional_children (list or str) – Additional children to use (see the children attribute)

  • additional_dependencies (list or str) – Additional dependencies to use (see the dependencies attribute)

  • **kwargs – Further keywords may be used to specify different names for children, dependencies and connection formatoptions that match the setup of the plotter. Hence, keywords may be anything of the children, dependencies and connections attributes, with values being the name of the new formatoption in this plotter.

Methods:

diff(value)

Checks whether the given value differs from what is currently set

load_mask(data, value)

update(value)

Method that is call to update the formatoption on the axes

Attributes:

group

str.

name

str.

priority

int.

diff(value)[source]

Checks whether the given value differs from what is currently set

Parameters

value – A possible value to set (make sure that it has been validate via the validate attribute before)

Returns

True if the value differs from what is currently set

Return type

bool

group = 'masking'

str. Key of the group name in groups of this formatoption keyword

load_mask(data, value)[source]
name = 'Apply a mask'

str. A bit more verbose name than the formatoption key to be included in the gui. If None, the key is used in the gui

priority = 30

int. Priority value of the the formatoption determining when the formatoption is updated.

  • 10: at the end (for labels, etc.)

  • 20: before the plotting (e.g. for colormaps, etc.)

  • 30: before loading the data (e.g. for lonlatbox)

update(value)[source]

Method that is call to update the formatoption on the axes

Parameters

value – Value to update

class psy_simple.base.MaskBetween(key, plotter=None, index_in_list=None, additional_children=[], additional_dependencies=[], **kwargs)[source]

Bases: psy_simple.base.ValueMaskBase

Mask data points between two numbers

Possible types

float – The floating number to mask above

See also

maskless, maskleq, maskgreater, maskgeq

Parameters
  • key (str) – formatoption key in the plotter

  • plotter (psyplot.plotter.Plotter) – Plotter instance that holds this formatoption. If None, it is assumed that this instance serves as a descriptor.

  • index_in_list (int or None) – The index that shall be used if the data is a psyplot.InteractiveList

  • additional_children (list or str) – Additional children to use (see the children attribute)

  • additional_dependencies (list or str) – Additional dependencies to use (see the dependencies attribute)

  • **kwargs – Further keywords may be used to specify different names for children, dependencies and connection formatoptions that match the setup of the plotter. Hence, keywords may be anything of the children, dependencies and connections attributes, with values being the name of the new formatoption in this plotter.

Methods:

mask_func(data, value)

The masking function that is called

Attributes:

name

str.

mask_func(data, value)[source]

The masking function that is called

name = 'Mask between two values'

str. A bit more verbose name than the formatoption key to be included in the gui. If None, the key is used in the gui

class psy_simple.base.MaskGeq(key, plotter=None, index_in_list=None, additional_children=[], additional_dependencies=[], **kwargs)[source]

Bases: psy_simple.base.ValueMaskBase

Mask data points greater than or equal to a number

Possible types

float – The floating number to mask above

See also

maskless, maskleq, maskgreater, maskbetween

Parameters
  • key (str) – formatoption key in the plotter

  • plotter (psyplot.plotter.Plotter) – Plotter instance that holds this formatoption. If None, it is assumed that this instance serves as a descriptor.

  • index_in_list (int or None) – The index that shall be used if the data is a psyplot.InteractiveList

  • additional_children (list or str) – Additional children to use (see the children attribute)

  • additional_dependencies (list or str) – Additional dependencies to use (see the dependencies attribute)

  • **kwargs – Further keywords may be used to specify different names for children, dependencies and connection formatoptions that match the setup of the plotter. Hence, keywords may be anything of the children, dependencies and connections attributes, with values being the name of the new formatoption in this plotter.

Methods:

mask_func(data, value)

The masking function that is called

Attributes:

name

str.

mask_func(data, value)[source]

The masking function that is called

name = 'Mask greater than or equal'

str. A bit more verbose name than the formatoption key to be included in the gui. If None, the key is used in the gui

class psy_simple.base.MaskGreater(key, plotter=None, index_in_list=None, additional_children=[], additional_dependencies=[], **kwargs)[source]

Bases: psy_simple.base.ValueMaskBase

Mask data points greater than a number

Possible types

float – The floating number to mask above

See also

maskless, maskleq, maskgeq, maskbetween

Parameters
  • key (str) – formatoption key in the plotter

  • plotter (psyplot.plotter.Plotter) – Plotter instance that holds this formatoption. If None, it is assumed that this instance serves as a descriptor.

  • index_in_list (int or None) – The index that shall be used if the data is a psyplot.InteractiveList

  • additional_children (list or str) – Additional children to use (see the children attribute)

  • additional_dependencies (list or str) – Additional dependencies to use (see the dependencies attribute)

  • **kwargs – Further keywords may be used to specify different names for children, dependencies and connection formatoptions that match the setup of the plotter. Hence, keywords may be anything of the children, dependencies and connections attributes, with values being the name of the new formatoption in this plotter.

Methods:

mask_func(data, value)

The masking function that is called

Attributes:

name

str.

mask_func(data, value)[source]

The masking function that is called

name = 'Mask greater'

str. A bit more verbose name than the formatoption key to be included in the gui. If None, the key is used in the gui

class psy_simple.base.MaskLeq(key, plotter=None, index_in_list=None, additional_children=[], additional_dependencies=[], **kwargs)[source]

Bases: psy_simple.base.ValueMaskBase

Mask data points smaller than or equal to a number

Possible types

float – The floating number to mask below

See also

maskless, maskgreater, maskgeq, maskbetween

Parameters
  • key (str) – formatoption key in the plotter

  • plotter (psyplot.plotter.Plotter) – Plotter instance that holds this formatoption. If None, it is assumed that this instance serves as a descriptor.

  • index_in_list (int or None) – The index that shall be used if the data is a psyplot.InteractiveList

  • additional_children (list or str) – Additional children to use (see the children attribute)

  • additional_dependencies (list or str) – Additional dependencies to use (see the dependencies attribute)

  • **kwargs – Further keywords may be used to specify different names for children, dependencies and connection formatoptions that match the setup of the plotter. Hence, keywords may be anything of the children, dependencies and connections attributes, with values being the name of the new formatoption in this plotter.

Methods:

mask_func(data, value)

The masking function that is called

Attributes:

name

str.

mask_func(data, value)[source]

The masking function that is called

name = 'Mask lesser than or equal'

str. A bit more verbose name than the formatoption key to be included in the gui. If None, the key is used in the gui

class psy_simple.base.MaskLess(key, plotter=None, index_in_list=None, additional_children=[], additional_dependencies=[], **kwargs)[source]

Bases: psy_simple.base.ValueMaskBase

Mask data points smaller than a number

Possible types

float – The floating number to mask below

See also

maskleq, maskgreater, maskgeq, maskbetween

Parameters
  • key (str) – formatoption key in the plotter

  • plotter (psyplot.plotter.Plotter) – Plotter instance that holds this formatoption. If None, it is assumed that this instance serves as a descriptor.

  • index_in_list (int or None) – The index that shall be used if the data is a psyplot.InteractiveList

  • additional_children (list or str) – Additional children to use (see the children attribute)

  • additional_dependencies (list or str) – Additional dependencies to use (see the dependencies attribute)

  • **kwargs – Further keywords may be used to specify different names for children, dependencies and connection formatoptions that match the setup of the plotter. Hence, keywords may be anything of the children, dependencies and connections attributes, with values being the name of the new formatoption in this plotter.

Methods:

mask_func(data, value)

The masking function that is called

Attributes:

name

str.

mask_func(data, value)[source]

The masking function that is called

name = 'Mask less'

str. A bit more verbose name than the formatoption key to be included in the gui. If None, the key is used in the gui

class psy_simple.base.Text(*args, **kwargs)[source]

Bases: psy_simple.base.TextBase, psyplot.plotter.Formatoption

Add text anywhere on the plot

This formatoption draws a text on the specified position on the figure. You can insert any meta key from the xarray.DataArray.attrs via a string like '%(key)s'. Furthermore there are some special cases:

  • Strings like '%Y', '%b', etc. will be replaced using the datetime.datetime.strftime() method as long as the data has a time coordinate and this can be converted to a datetime object.

  • '%(x)s', '%(y)s', '%(z)s', '%(t)s' will be replaced by the value of the x-, y-, z- or time coordinate (as long as this coordinate is one-dimensional in the data)

  • any attribute of one of the above coordinates is inserted via axis + key (e.g. the name of the x-coordinate can be inserted via '%(xname)s').

  • Labels defined in the psyplot.rcParams 'texts.labels' key are also replaced when enclosed by ‘{}’. The standard labels are

    • tinfo: %H:%M

    • dtinfo: %B %d, %Y. %H:%M

    • dinfo: %B %d, %Y

    • desc: %(long_name)s [%(units)s]

    • sdesc: %(name)s [%(units)s]

Possible types

  • str – If string s: this will be used as (1., 1., s, {‘ha’: ‘right’}) (i.e. a string in the upper right corner of the axes).

  • tuple or list of tuples (x,y,s[,coord.-system][,options]]) – Each tuple defines a text instance on the plot. 0<=x, y<=1 are the coordinates. The coord.-system can be either the data coordinates (default, 'data') or the axes coordinates ('axes') or the figure coordinates (‘fig’). The string s finally is the text. options may be a dictionary to specify format the appearence (e.g. 'color', 'fontweight', 'fontsize', etc., see matplotlib.text.Text for possible keys). To remove one single text from the plot, set (x,y,’’[, coord.-system]) for the text at position (x,y)

  • empty list – remove all texts from the plot

See also

title, figtitle

Methods:

diff(value)

Checks whether the given value differs from what is currently set

finish_update()

Clears the _texts_to_remove set

remove()

Method to remove the effects of this formatoption

set_value(value[, validate, todefault])

Set (and validate) the value in the plotter.

share(fmto, **kwargs)

Share the settings of this formatoption with other data objects

update(value[, texts_to_remove])

Method that is call to update the formatoption on the axes

Attributes:

name

str.

transform

Dictionary containing the relevant transformations

diff(value)[source]

Checks whether the given value differs from what is currently set

Parameters

value – A possible value to set (make sure that it has been validate via the validate attribute before)

Returns

True if the value differs from what is currently set

Return type

bool

finish_update()[source]

Clears the _texts_to_remove set

name = 'Arbitrary text on the plot'

str. A bit more verbose name than the formatoption key to be included in the gui. If None, the key is used in the gui

remove()[source]

Method to remove the effects of this formatoption

This method is called when the axes is cleared due to a formatoption with requires_clearing set to True. You don’t necessarily have to implement this formatoption if your plot results are removed by the usual matplotlib.axes.Axes.clear() method.

set_value(value, validate=True, todefault=False)[source]

Set (and validate) the value in the plotter. This method is called by the plotter when it attempts to change the value of the formatoption.

Parameters
  • value – Value to set

  • validate (bool) – if True, validate the value before it is set

  • todefault (bool) – True if the value is updated to the default value

share(fmto, **kwargs)[source]

Share the settings of this formatoption with other data objects

Parameters
  • fmto (Formatoption) – The Formatoption instance to share the attributes with

  • **kwargs – Any other keyword argument that shall be passed to the update method of fmto

Notes

The Text formatoption sets the ‘texts_to_remove’ keyword to the _texts_to_remove attribute of this instance (if not already specified in **kwargs

property transform

Dictionary containing the relevant transformations

update(value, texts_to_remove=None)[source]

Method that is call to update the formatoption on the axes

Parameters

value – Value to update

class psy_simple.base.TextBase[source]

Bases: object

Abstract base class for formatoptions that provides a replace method

Attributes:

data_dependent

delimiter

enhanced_attrs

The enhanced attributes of the array

group

rc

SubDict of rcParams 'texts' key

Methods:

get_enhanced_attrs(*args, **kwargs)

get_fig_data_attrs([delimiter])

Join the data attributes with other plotters in the project

get_fmt_widget(parent, project)

Create a combobox with the attributes

replace(s, data[, attrs])

Replace the attributes of the plotter data in a string

data_dependent = True
delimiter = None
property enhanced_attrs

The enhanced attributes of the array

get_enhanced_attrs(*args, **kwargs)[source]
get_fig_data_attrs(delimiter=None)[source]

Join the data attributes with other plotters in the project

This method joins the attributes of the InteractiveBase instances in the project that draw on the same figure as this instance does.

Parameters

delimiter (str) – Specifies the delimiter with what the attributes are joined. If None, the delimiter attribute of this instance or (if the latter is also None), the rcParams[‘texts.delimiter’] item is used.

Returns

A dictionary with all the meta attributes joined by the specified delimiter

Return type

dict

get_fmt_widget(parent, project)[source]

Create a combobox with the attributes

group = 'labels'
property rc

SubDict of rcParams ‘texts’ key

replace(s, data, attrs=None)[source]

Replace the attributes of the plotter data in a string

You can insert any meta key from the xarray.DataArray.attrs via a string like '%(key)s'. Furthermore there are some special cases:

  • Strings like '%Y', '%b', etc. will be replaced using the datetime.datetime.strftime() method as long as the data has a time coordinate and this can be converted to a datetime object.

  • '%(x)s', '%(y)s', '%(z)s', '%(t)s' will be replaced by the value of the x-, y-, z- or time coordinate (as long as this coordinate is one-dimensional in the data)

  • any attribute of one of the above coordinates is inserted via axis + key (e.g. the name of the x-coordinate can be inserted via '%(xname)s').

  • Labels defined in the psyplot.rcParams 'texts.labels' key are also replaced when enclosed by ‘{}’. The standard labels are

    • tinfo: %H:%M

    • dtinfo: %B %d, %Y. %H:%M

    • dinfo: %B %d, %Y

    • desc: %(long_name)s [%(units)s]

    • sdesc: %(name)s [%(units)s]

Parameters
  • s (str) – String where the replacements shall be made

  • data (InteractiveBase) – Data object from which to use the coordinates and insert the coordinate and attribute informations

  • attrs (dict) – Meta attributes that shall be used for replacements. If None, it will be gained from data.attrs

Returns

s with inserted informations

Return type

str

class psy_simple.base.Tight(key, plotter=None, index_in_list=None, additional_children=[], additional_dependencies=[], **kwargs)[source]

Bases: psyplot.plotter.Formatoption

Automatically adjust the plots.

If set to True, the plots are automatically adjusted to fit to the figure limitations via the matplotlib.pyplot.tight_layout() function.

Possible types

bool – True for automatic adjustment

Warning

There is no update method to undo what happend after this formatoption is set to True!

Parameters
  • key (str) – formatoption key in the plotter

  • plotter (psyplot.plotter.Plotter) – Plotter instance that holds this formatoption. If None, it is assumed that this instance serves as a descriptor.

  • index_in_list (int or None) – The index that shall be used if the data is a psyplot.InteractiveList

  • additional_children (list or str) – Additional children to use (see the children attribute)

  • additional_dependencies (list or str) – Additional dependencies to use (see the dependencies attribute)

  • **kwargs – Further keywords may be used to specify different names for children, dependencies and connection formatoptions that match the setup of the plotter. Hence, keywords may be anything of the children, dependencies and connections attributes, with values being the name of the new formatoption in this plotter.

Attributes:

group

str.

name

str.

Methods:

update(value)

Method that is call to update the formatoption on the axes

group = 'axes'

str. Key of the group name in groups of this formatoption keyword

name = 'Tight layout'

str. A bit more verbose name than the formatoption key to be included in the gui. If None, the key is used in the gui

update(value)[source]

Method that is call to update the formatoption on the axes

Parameters

value – Value to update

class psy_simple.base.Title(key, plotter=None, index_in_list=None, additional_children=[], additional_dependencies=[], **kwargs)[source]

Bases: psy_simple.base.TextBase, psyplot.plotter.Formatoption

Show the title

Set the title of the plot. You can insert any meta key from the xarray.DataArray.attrs via a string like '%(key)s'. Furthermore there are some special cases:

  • Strings like '%Y', '%b', etc. will be replaced using the datetime.datetime.strftime() method as long as the data has a time coordinate and this can be converted to a datetime object.

  • '%(x)s', '%(y)s', '%(z)s', '%(t)s' will be replaced by the value of the x-, y-, z- or time coordinate (as long as this coordinate is one-dimensional in the data)

  • any attribute of one of the above coordinates is inserted via axis + key (e.g. the name of the x-coordinate can be inserted via '%(xname)s').

  • Labels defined in the psyplot.rcParams 'texts.labels' key are also replaced when enclosed by ‘{}’. The standard labels are

    • tinfo: %H:%M

    • dtinfo: %B %d, %Y. %H:%M

    • dinfo: %B %d, %Y

    • desc: %(long_name)s [%(units)s]

    • sdesc: %(name)s [%(units)s]

Possible types

str – The title for the title() function.

Notes

This is the title of this specific subplot! For the title of the whole figure, see the figtitle formatoption.

See also

figtitle, titlesize, titleweight, titleprops

Parameters
  • key (str) – formatoption key in the plotter

  • plotter (psyplot.plotter.Plotter) – Plotter instance that holds this formatoption. If None, it is assumed that this instance serves as a descriptor.

  • index_in_list (int or None) – The index that shall be used if the data is a psyplot.InteractiveList

  • additional_children (list or str) – Additional children to use (see the children attribute)

  • additional_dependencies (list or str) – Additional dependencies to use (see the dependencies attribute)

  • **kwargs – Further keywords may be used to specify different names for children, dependencies and connection formatoptions that match the setup of the plotter. Hence, keywords may be anything of the children, dependencies and connections attributes, with values being the name of the new formatoption in this plotter.

Methods:

initialize_plot(value)

Method that is called when the plot is made the first time

update(value)

Method that is call to update the formatoption on the axes

Attributes:

name

str.

initialize_plot(value)[source]

Method that is called when the plot is made the first time

Parameters

value – The value to use for the initialization

name = 'Axes title'

str. A bit more verbose name than the formatoption key to be included in the gui. If None, the key is used in the gui

update(value)[source]

Method that is call to update the formatoption on the axes

Parameters

value – Value to update

class psy_simple.base.TitlesPlotter(data=None, ax=None, auto_update=None, project=None, draw=False, make_plot=True, clear=False, enable_post=False, **kwargs)[source]

Bases: psyplot.plotter.Plotter

Plotter class for labels

Parameters
  • data (InteractiveArray or ArrayList, optional) – Data object that shall be visualized. If given and plot is True, the initialize_plot() method is called at the end. Otherwise you can call this method later by yourself

  • ax (matplotlib.axes.Axes) – Matplotlib Axes to plot on. If None, a new one will be created as soon as the initialize_plot() method is called

  • auto_update (bool) – Default: None. A boolean indicating whether this list shall automatically update the contained arrays when calling the update() method or not. See also the no_auto_update attribute. If None, the value from the 'lists.auto_update' key in the psyplot.rcParams dictionary is used.

  • draw (bool or None) – Boolean to control whether the figure of this array shall be drawn at the end. If None, it defaults to the ‘auto_draw’` parameter in the psyplot.rcParams dictionary

  • make_plot (bool) – If True, and data is not None, the plot is initialized. Otherwise only the framework between plotter and data is set up

  • clear (bool) – If True, the axes is cleared first

  • enable_post (bool) – If True, the post formatoption is enabled and post processing scripts are allowed

  • **kwargs – Any formatoption key from the formatoptions attribute that shall be used

Label formatoptions:

figtitle

Plot a figure title

figtitleprops

Properties of the figure title

figtitlesize

Set the size of the figure title

figtitleweight

Set the fontweight of the figure title

text

Add text anywhere on the plot

title

Show the title

titleprops

Properties of the title

titlesize

Set the size of the title

titleweight

Set the fontweight of the title

Post processing formatoptions:

post

Apply your own postprocessing script

post_timing

Determine when to run the post formatoption

figtitle

Plot a figure title

Set the title of the figure. You can insert any meta key from the xarray.DataArray.attrs via a string like '%(key)s'. Furthermore there are some special cases:

  • Strings like '%Y', '%b', etc. will be replaced using the datetime.datetime.strftime() method as long as the data has a time coordinate and this can be converted to a datetime object.

  • '%(x)s', '%(y)s', '%(z)s', '%(t)s' will be replaced by the value of the x-, y-, z- or time coordinate (as long as this coordinate is one-dimensional in the data)

  • any attribute of one of the above coordinates is inserted via axis + key (e.g. the name of the x-coordinate can be inserted via '%(xname)s').

  • Labels defined in the psyplot.rcParams 'texts.labels' key are also replaced when enclosed by ‘{}’. The standard labels are

    • tinfo: %H:%M

    • dtinfo: %B %d, %Y. %H:%M

    • dinfo: %B %d, %Y

    • desc: %(long_name)s [%(units)s]

    • sdesc: %(name)s [%(units)s]

Possible types

str – The title for the suptitle() function

Notes

  • If the plotter is part of a psyplot.project.Project and multiple plotters of this project are on the same figure, the replacement attributes (see above) are joined by a delimiter. If the delimiter attribute of this Figtitle instance is not None, it will be used. Otherwise the rcParams[‘texts.delimiter’] item is used.

  • This is the title of the whole figure! For the title of this specific subplot, see the title formatoption.

figtitleprops

Properties of the figure title

Specify the font properties of the figure title manually.

Possible types

dict – Items may be any valid text property

figtitlesize

Set the size of the figure title

Possible types

  • float – The absolute font size in points (e.g., 12)

  • string – Strings might be ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’.

figtitleweight

Set the fontweight of the figure title

Possible types

  • float – a float between 0 and 1000

  • string – Possible strings are one of ‘ultralight’, ‘light’, ‘normal’, ‘regular’, ‘book’, ‘medium’, ‘roman’, ‘semibold’, ‘demibold’, ‘demi’, ‘bold’, ‘heavy’, ‘extra bold’, ‘black’.

post

Apply your own postprocessing script

This formatoption let’s you apply your own post processing script. Just enter the script as a string and it will be executed. The formatoption will be made available via the self variable

Possible types

  • None – Don’t do anything

  • str – The post processing script as string

Note

This formatoption uses the built-in exec() function to compile the script. Since this poses a security risk when loading psyplot projects, it is by default disabled through the Plotter.enable_post attribute. If you are sure that you can trust the script in this formatoption, set this attribute of the corresponding Plotter to True

Examples

Assume, you want to manually add the mean of the data to the title of the matplotlib axes. You can simply do this via

from psyplot.plotter import Plotter
from xarray import DataArray
plotter = Plotter(DataArray([1, 2, 3]))
# enable the post formatoption
plotter.enable_post = True
plotter.update(post="self.ax.set_title(str(self.data.mean()))")
plotter.ax.get_title()
'2.0'

By default, the post formatoption is only ran, when it is explicitly updated. However, you can use the post_timing formatoption, to run it automatically. E.g. for running it after every update of the plotter, you can set

plotter.update(post_timing='always')

See also

post_timing

Determine the timing of this formatoption

post_timing

Determine when to run the post formatoption

This formatoption determines, whether the post formatoption should be run never, after replot or after every update.

Possible types

  • ‘never’ – Never run post processing scripts

  • ‘always’ – Always run post processing scripts

  • ‘replot’ – Only run post processing scripts when the data changes or a replot is necessary

See also

post

The post processing formatoption

text

Add text anywhere on the plot

This formatoption draws a text on the specified position on the figure. You can insert any meta key from the xarray.DataArray.attrs via a string like '%(key)s'. Furthermore there are some special cases:

  • Strings like '%Y', '%b', etc. will be replaced using the datetime.datetime.strftime() method as long as the data has a time coordinate and this can be converted to a datetime object.

  • '%(x)s', '%(y)s', '%(z)s', '%(t)s' will be replaced by the value of the x-, y-, z- or time coordinate (as long as this coordinate is one-dimensional in the data)

  • any attribute of one of the above coordinates is inserted via axis + key (e.g. the name of the x-coordinate can be inserted via '%(xname)s').

  • Labels defined in the psyplot.rcParams 'texts.labels' key are also replaced when enclosed by ‘{}’. The standard labels are

    • tinfo: %H:%M

    • dtinfo: %B %d, %Y. %H:%M

    • dinfo: %B %d, %Y

    • desc: %(long_name)s [%(units)s]

    • sdesc: %(name)s [%(units)s]

Possible types

  • str – If string s: this will be used as (1., 1., s, {‘ha’: ‘right’}) (i.e. a string in the upper right corner of the axes).

  • tuple or list of tuples (x,y,s[,coord.-system][,options]]) – Each tuple defines a text instance on the plot. 0<=x, y<=1 are the coordinates. The coord.-system can be either the data coordinates (default, 'data') or the axes coordinates ('axes') or the figure coordinates (‘fig’). The string s finally is the text. options may be a dictionary to specify format the appearence (e.g. 'color', 'fontweight', 'fontsize', etc., see matplotlib.text.Text for possible keys). To remove one single text from the plot, set (x,y,’’[, coord.-system]) for the text at position (x,y)

  • empty list – remove all texts from the plot

See also

title, figtitle

title

Show the title

Set the title of the plot. You can insert any meta key from the xarray.DataArray.attrs via a string like '%(key)s'. Furthermore there are some special cases:

  • Strings like '%Y', '%b', etc. will be replaced using the datetime.datetime.strftime() method as long as the data has a time coordinate and this can be converted to a datetime object.

  • '%(x)s', '%(y)s', '%(z)s', '%(t)s' will be replaced by the value of the x-, y-, z- or time coordinate (as long as this coordinate is one-dimensional in the data)

  • any attribute of one of the above coordinates is inserted via axis + key (e.g. the name of the x-coordinate can be inserted via '%(xname)s').

  • Labels defined in the psyplot.rcParams 'texts.labels' key are also replaced when enclosed by ‘{}’. The standard labels are

    • tinfo: %H:%M

    • dtinfo: %B %d, %Y. %H:%M

    • dinfo: %B %d, %Y

    • desc: %(long_name)s [%(units)s]

    • sdesc: %(name)s [%(units)s]

Possible types

str – The title for the title() function.

Notes

This is the title of this specific subplot! For the title of the whole figure, see the figtitle formatoption.

titleprops

Properties of the title

Specify the font properties of the figure title manually.

Possible types

dict – Items may be any valid text property

titlesize

Set the size of the title

Possible types

  • float – The absolute font size in points (e.g., 12)

  • string – Strings might be ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’.

titleweight

Set the fontweight of the title

Possible types

  • float – a float between 0 and 1000

  • string – Possible strings are one of ‘ultralight’, ‘light’, ‘normal’, ‘regular’, ‘book’, ‘medium’, ‘roman’, ‘semibold’, ‘demibold’, ‘demi’, ‘bold’, ‘heavy’, ‘extra bold’, ‘black’.

class psy_simple.base.ValueMaskBase(key, plotter=None, index_in_list=None, additional_children=[], additional_dependencies=[], **kwargs)[source]

Bases: psyplot.plotter.Formatoption

Base class for masking formatoptions

Parameters
  • key (str) – formatoption key in the plotter

  • plotter (psyplot.plotter.Plotter) – Plotter instance that holds this formatoption. If None, it is assumed that this instance serves as a descriptor.

  • index_in_list (int or None) – The index that shall be used if the data is a psyplot.InteractiveList

  • additional_children (list or str) – Additional children to use (see the children attribute)

  • additional_dependencies (list or str) – Additional dependencies to use (see the dependencies attribute)

  • **kwargs – Further keywords may be used to specify different names for children, dependencies and connection formatoptions that match the setup of the plotter. Hence, keywords may be anything of the children, dependencies and connections attributes, with values being the name of the new formatoption in this plotter.

Attributes:

data_dependent

bool or a callable.

group

str.

priority

int.

Methods:

mask_func()

The masking function that is called

update(value)

Method that is call to update the formatoption on the axes

data_dependent = True

bool or a callable. This attribute indicates whether this Formatoption depends on the data and should be updated if the data changes. If it is a callable, it must accept one argument: the new data. (Note: This is automatically set to True for plot formatoptions)

group = 'masking'

str. Key of the group name in groups of this formatoption keyword

abstract mask_func()[source]

The masking function that is called

priority = 30

int. Priority value of the the formatoption determining when the formatoption is updated.

  • 10: at the end (for labels, etc.)

  • 20: before the plotting (e.g. for colormaps, etc.)

  • 30: before loading the data (e.g. for lonlatbox)

update(value)[source]

Method that is call to update the formatoption on the axes

Parameters

value – Value to update

psy_simple.base.label_props(base, label_name=None, children=[], parents=[], dependencies=[])[source]

Function that returns a Formatoption class for modifying the fontsite

This function returns a Formatoption instance that modifies the size of the given base formatoption

Parameters
  • base (Formatoption) – The base formatoption instance that is used in the psyplot.Plotter subclass to create the label. The instance must have a texts attribute which stores all the matplotlib.text.Text instances.

  • label_name (str) – The name of the label to use in the documentation. If None, it will be key, where key is the psyplot.plotter.Formatoption.key` attribute of base

  • children (list of str) – The childrens of the resulting formatoption class (besides the base formatoption which is included anyway)

  • parents (list of str) – The parents of the resulting formatoption class (besides the base the properties formatoption from base (see label_props()))

  • dependencies (list of str) – The dependencies of the formatoption

  • children – The childrens of the resulting formatoption class (besides the base formatoption, the base.key + 'size' and base.key + 'weight' keys, which are included anyway (see label_size(), label_weight()))

  • parents – The parents of the resulting formatoption class

Returns

The formatoption instance that modifies the fontsize of base

Return type

Formatoption

psy_simple.base.label_size(base, label_name=None, children=[], parents=[], dependencies=[])[source]

Function that returns a Formatoption class for modifying the fontsite

This function returns a Formatoption instance that modifies the size of the given base formatoption

Parameters
  • base (Formatoption) – The base formatoption instance that is used in the psyplot.Plotter subclass to create the label. The instance must have a texts attribute which stores all the matplotlib.text.Text instances.

  • label_name (str) – The name of the label to use in the documentation. If None, it will be key, where key is the psyplot.plotter.Formatoption.key` attribute of base

  • children (list of str) – The childrens of the resulting formatoption class (besides the base formatoption which is included anyway)

  • parents (list of str) – The parents of the resulting formatoption class (besides the base the properties formatoption from base (see label_props()))

  • dependencies (list of str) – The dependencies of the formatoption

Returns

The formatoption instance that modifies the fontsize of base

Return type

Formatoption

psy_simple.base.label_weight(base, label_name=None, children=[], parents=[], dependencies=[])[source]

Function that returns a Formatoption class for modifying the fontweight

This function returns a Formatoption instance that modifies the weight of the given base formatoption

Parameters
  • base (Formatoption) – The base formatoption instance that is used in the psyplot.Plotter subclass to create the label. The instance must have a texts attribute which stores all the matplotlib.text.Text instances.

  • label_name (str) – The name of the label to use in the documentation. If None, it will be key, where key is the psyplot.plotter.Formatoption.key` attribute of base

  • children (list of str) – The childrens of the resulting formatoption class (besides the base formatoption which is included anyway)

  • parents (list of str) – The parents of the resulting formatoption class (besides the base the properties formatoption from base (see label_props()))

  • dependencies (list of str) – The dependencies of the formatoption

Returns

The formatoption instance that modifies the fontweight of base

Return type

Formatoption