API

List of commands, which can be applied on initialized instance of the chosen class, is presented in the following.

mplstyle.set_style(*args, **kwargs)

Chooses style for color, color order and plt style. Arguments can be entered in two ways. First one assumes, that only a name of a style in the form of string is given. In this case all settings will be changed at one time. Second case allows to change a specific setting (color, color order and plt style) by putting a couple setting=’style’ as an argument. Two or three arguments are also possible in this case. Concept of inputs *args and **kwargs make it possible. More detailed explanation about nature of this concept is written here.

Parameters:
  • *args

    name of the style;

  • **kwargs

    couple in the form setting=’style’.

mplstyle.get_colors()
Returns:dictionary of colors used in the chosen color style.
mplstyle.get_color_order()
Returns:list of colors from the chosen color order style in order of appearance.
mplstyle.get_available_styles()
Returns:all available styles for each plotting setting (color, color order and plt style).
mplstyle.get_selected_style()
Returns:chosen style for color, color order and plt style.
mplstyle.get_cmap(colors, position=None, bit=False)

Generates custom color maps for Matplotlib. The method allows to create a list of tuples with 8-bit (0 to 255) or arithmetic (0.0 to 1.0) RGB values for making linear color maps. Color tuple placed first characterizes the lowest value of the color bar. The last tuple represents the the highest value.

Parameters:
  • colors – list of RGB tuples with 8-bit (0 to 255) or arithmetic (0 to 1), default: arithmetic;
  • position – list from 0 to 1, which dictates the location for each color;
  • bit – boolean, default: False (arithmetic), True (RGB);
Returns:

cmap - a color map with equally spaced colors.

Example1:

cmap = mplstyle.get_cmap(colors=[(255, 0, 0), (0, 157, 0)], bit=True)

Example2:

cmap = mplstyle.get_cmap([(1, 1, 1), (0.5, 0, 0)], position=[0, 1]))

mplstyle.add_zbild(ax, x, y, text, tum=True, fontsize=10, color='grey')

Sets ZBild number as a text in the chart.

Parameters:
  • ax – instance of matplotlib axes;
  • x – float for position (xmin=0, xmax=1);
  • y – float for position (ymin=0, ymax=1);
  • text – string for the text;
  • tum – optional boolean for copyright, default: (tum=True);
  • fontsize – optional float for font size, default: (10);
  • color – optional string for mpl color, default: (grey).