displayConfig#

class mrinufft.trajectories.display.displayConfig(**kwargs)[source]#

Bases: object

A container class used to share arguments related to display.

The values can be updated either directy (and permanently) or temporarily by using a context manager.

Examples

>>> from mrinufft.trajectories.display import displayConfig
>>> displayConfig.alpha
0.2
>>> with displayConfig(alpha=0.5):
        print(displayConfig.alpha)
0.5
>>> displayConfig.alpha
0.2

Methods

__init__

Update the display configuration.

get_colorlist

Extract a list of colors from a matplotlib palette.

reset

Restore the display configuration.

update

Update the display configuration.

Attributes

alpha

Transparency used for area plots, by default 0.2.

fontsize

Font size for most labels and texts, by default 18.

gradient_point_color

Matplotlib color for gradient constraint points, by default "r" (red).

linewidth

Width for lines or curves, by default 2.

nb_colors

Number of colors to use in the color cycle, by default 10.

one_shot_color

Matplotlib color for the highlighted shot, by default "k" (black).

palette

Name of the color palette to use, by default "tab10".

pointsize

Size for points used to show constraints, by default 10.

slewrate_point_color

Matplotlib color for slew rate constraint points, by default "b" (blue).

small_fontsize

Font size for smaller texts, by default 14.

alpha: float = 0.2#

Transparency used for area plots, by default 0.2.

linewidth: float = 2#

Width for lines or curves, by default 2.

pointsize: int = 10#

Size for points used to show constraints, by default 10.

fontsize: int = 18#

Font size for most labels and texts, by default 18.

small_fontsize: int = 14#

Font size for smaller texts, by default 14.

nb_colors = 10#

Number of colors to use in the color cycle, by default 10.

palette: str = 'tab10'#

Name of the color palette to use, by default "tab10". This can be any of the matplotlib colormaps, or a list of colors.

one_shot_color: str = 'k'#

Matplotlib color for the highlighted shot, by default "k" (black).

gradient_point_color: str = 'r'#

Matplotlib color for gradient constraint points, by default "r" (red).

slewrate_point_color: str = 'b'#

Matplotlib color for slew rate constraint points, by default "b" (blue).

update(**kwargs)[source]#

Update the display configuration.

reset()[source]#

Restore the display configuration.

classmethod get_colorlist()[source]#

Extract a list of colors from a matplotlib palette.

If the palette is continuous, the colors will be sampled from it. If its a categorical palette, the colors will be used in cycle.

Parameters:
  • palette (str, or list of colors, or matplotlib colormap) – Name of the palette to use, or list of colors, or matplotlib colormap.

  • nb_colors (int, optional) – Number of colors to extract from the palette. The default is -1, and the value will be read from displayConfig.nb_colors.

Returns:

colorlist

Return type:

list of matplotlib colors.