mplstyler

An API for assigning consistent marker styles to plots. Assign colours, markers, line-styles to labels and re-use on subsequent plots.


Keywords
bioinformatics, research, analysis, science
License
GPL-2.0+
Install
pip install mplstyler==0.1

Documentation

mplstyler

An API for ensuring consistent line and marker styles across your plots. Assign colours, markers, line-styles to labels and re-use on subsequent plots. Styles can be matched to specific labels using exact or fuzzy matching to consecutively build up styles. Export styles to XML and re-import in subsequent sessions.

The following demo shows how to use StylesManager in auto mode to automatically set colors. More examples will be added shortly demonstrating the use of manual-styles.

Future planned features include XML import/export of styles and integration with mpltools.

::python

from mplstyler import StylesManager

styles = StylesManager() ::python

from pylab import * ::python

x = linspace(0, 5, 10) y1 = x ** 2 y2 = x ** 3 ::python

figure()

s = styles.get_style_for_class('Series 1') plot(x, y1, **s.kwargs)

s = styles.get_style_for_class('Series 2') plot(x, y2, **s.kwargs)

show()

output_4_0.png

Notice that Series 1 has again been displayed using the same colour, since the classname ('Series 1') is unchanged. However, Series 3 is assigned a new colour as it doesn't match any of the previous classes.