mgkit.plots.utils module

New in version 0.1.14.

Misc code

mgkit.plots.utils.get_grid_figure(rows, cols, dpi=300, figsize=(10, 20), **kwd)[source]

New in version 0.1.13.

Simple wrapper to init a GridSpec figure

Parameters:
  • rows (int) – number of rows
  • columns (int) – number of columns
  • dpi (int) – dpi used for the figure
  • figsize (tuple) – size of the figure in inches
Returns:

the figure and axes objects

Return type:

tuple

mgkit.plots.utils.get_single_figure(dpi=300, figsize=(10, 20), aspect='auto')[source]

Changed in version 0.1.14: added aspect parameter

Simple wrapper to init a single figure

Parameters:
  • dpi (int) – dpi used for the figure
  • figsize (tuple) – size of the figure in inches
  • aspect (str, float) – aspect ratio to be passed to figure.add_subplot
Returns:

the figure and axes objects

Return type:

tuple

mgkit.plots.utils.legend_patches(labels, colors)[source]

New in version 0.3.1.

Makes handles (using matplotlib Patch) that can be passed to the legend method of a matplotlib axes instance

Parameters:
  • labels (iterable) – iterable that yields a label
  • colors (iterable) – iterable that yields a valid matplotlib color
Returns:

list of patches that can be passed to the handles parameter in the ax.legend method

Return type:

list