Last year we implemented an object oriented plotting style system for our users 
and I was able to convince our management that we should open source it.  You 
can find it here:  https://github.com/nasa/mplStyle

Many (most?) of the existing MPL style systems seem to be built around RC 
parameters which doesn't work very well for us.  For a large system that can 
create plots in many different scripts/GUI's, we really can't change global 
settings (RC's) to affect how a plot looks as it ends up screwing up plots in 
other areas.  So we designed an OO based style system that allows you to 
create/save/load styles and apply them to individual plot elements (text, 
lines, axes, figures, etc).

This code was extracted from a much larger project so it wasn't really written 
as a standalone library or designed to follow MPL's naming and coding 
conventions.  i.e. don't assume the internals exhibit any great design - I was 
mostly concerned with getting a stand alone package that worked in the minimum 
amount of effort.  It does work fine, every method has documentation, and test 
cases are included (feel free to email me or use github if you find any 
problems) but my real hope is that it either serves as an inspiration for 
building a standard MPL OO style system (or perhaps it can be morphed into that 
over time).

Some of the features include:
- Object oriented style objects (no changes to global RC parameters)
- Apply styles to whole figures or to individual plot elements (artists, 
patches, axes, etc)
- Save and load styles into human editable files
- Apply styles by name or by style object
- Styles remember what they were applied to and can be told to re-apply after 
changes.  This is great way to try out style settings without having to 
regenerate a plot.
- Plot elements can be tagged with a name.  The tag name can later be used as a 
target in the style application.  This is great feature for plotting libraries 
as it allows a script to create plot elements with a set of names and the 
caller can apply various styles to the plot elements by using those names.  
This separates plot creation from plot styling and makes plotting code much 
easier to reuse as users don't need to edit the plotting script just to change 
the style of a line.

Please take a look and let us know what you think.  
Ted
ps: FYI for clarity I wasn't the primary author of this code - James Evans 
get's that honor with various contributions from a variety of people who work 
on our development team.
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to