Closed arsenovic closed 10 years ago
possibly a lot of your rcmod.py
could be implemented as style sheets.
https://github.com/matplotlib/matplotlib/tree/master/lib/matplotlib/style/stylelib
Yeah, I was thinking about that recently. The one thing is that I'm not sure how stylesheets would handle the context-dependent aspects of the seaborn styles? I actually think the implementation of this in seaborn.rcmod
is extremely janky, but I haven't thought of a better way. Maybe I could write some stylesheet templates and then plug in values based on the context and send those to the mpl style system?
i assume you are referring to the palette_context
function? i actually didnt notice this feature until you mentioned it. it seems like the mpl styles could be swapped out in an identical way as seaborn color palettes . i think that its a great idea, and i would use it. perhaps @tonysyu could provide some advice on this?
Ah, no, but reasonable confusion. The "context" parameter in seaborn.set()
doesn't mean context in the sense of a context manager (like palette_context
), but in terms of setting the aesthetics to have the same general look but with features tweaked for figures intended to end up in an interactive notebook vs. slides for a talk, an academic paper, etc: http://stanford.edu/~mwaskom/software/seaborn/aesthetics.html#changing-style-contexts
ok, i see. so.... my understanding is that your context
s are exactly what tony calls styles
.?
maybe ill pull the current maplotlib and try to add a *.mplstyle similar to seaborn.
in either case, i think using python's context manager (like you did with palette_context
) would allow this to be tweaked from kwargs on-the-fly .
ok, i started making a style file, and see why it may be tricky; the effects of changing the style
and context
, are not totally independent, (but mostly are)
if they were totally independent, the different style
s and context
s could be done with several .mplstyles that are loaded in series. however given the slight inter-mixing, you would have to have separate .mplstyles for each combination of context
and style
to retain current functionality.
inserting the .mplstyle functionality in between the steps of creating and applying these mpl rc-settings can be done, basically creating a seaborn_mplstyle_generator()
function. but i dont see huge benefit, except that they could be saved to disk, and you could re-use the mpl context manager function.
Yep, that's where the problems are.
I expect the style implementation to change (and hopefully stabilize) a bit over the next release or two. It might be better to revisit this then.
this project is great, and the aesthetics are thoughtfully designed. i love it. it would be nice for these style-improvements to be incorporated into mpl.
also, if you aren't already aware, tony yu is working on a similar project https://github.com/tonysyu/mpltools
he recently implemented the
styles
feature into mpl https://github.com/matplotlib/matplotlib/pull/2236