I've been thinking a lot lately about how CSS could be used to specify styles in matplotlib. It would allow one to specify any set of styles to cycle through (colors, linestyles, whatever other properties).

   axes.nth-child(0) { color: blue }
   axes.nth-child(1) { color: green }

vs.

   axes.nth-child(0) { dashes: dotted }
   axes.nth-child(1) { dashed: dashed }

The obstacles to integrating something like that are that a) matplotlib currently doesn't maintain the fact that a plot's style was "unset" at the time of creation, and b) the heirarchy of plot objects is a little tangled, so it would be hard to specify using CSS selectors what should be styled.

It does keep popping up in my brain as a clean and complete solution to the problem of styling, but there would need to be a number of changes to the internal plumbing to make it work.

Mike

On 10/03/2012 08:48 AM, Benjamin Root wrote:


On Tue, Oct 2, 2012 at 11:37 AM, Tony Yu <tsy...@gmail.com <mailto:tsy...@gmail.com>> wrote:



    On Tue, Oct 2, 2012 at 11:04 AM, Benjamin Root <ben.r...@ou.edu
    <mailto:ben.r...@ou.edu>> wrote:



        On Tue, Oct 2, 2012 at 8:31 AM, William Furnass
        <w...@thearete.co.uk <mailto:w...@thearete.co.uk>> wrote:

            Did anything ever come of the MPL black and white mode
            mentioned in
            the following?  I rarely want to produce colour plots and
            having an
            inbuilt mechanism for cycling through line styles that can be
            activated with a keyword argument would be very handy.

            
http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg00367.html

            Cheers,

            Will


        Perhap's Tony Yu's mpltools might be the closest we have
        gotten to this goal.  There has been a number of technical
        hurdles that I have not had the time or resources to iron
        out.  Hopefully, it will be helpful to you.

        http://tonysyu.github.com/mpltools/getting_started.html

        Cheers!
        Ben Root


    Thanks for the advertisement Ben ;)

    Will: If you're just interested in grayscale plotting, here's a
    direct link to the example:

    http://tonysyu.github.com/mpltools/auto_examples/style/plot_grayscale.html

    The discussion that you link to talks specifically about line
    styles. In the past there's been discussion of adding a linestyle
    cycle rc param, but I don't think there's been progress on that front.

    BTW, Ben: are you still thinking about some sort of hierarchical
    configuration management? I think it'd make a great MEP, if you
    find the time.


Not necessarily a hierarchical config management, but rather a hierarchical property management. Of course, this was before I discovered GraphicsContext, which makes me wonder if it could be generalized and moved out of the backends to serve such a purpose.

Of course, with regards to rcparams, we definitely need to re-examine how we are doing it right now before it gets too bloated...

Ben Root



------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev


_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to