As a side note, SVG already has specs which extend css to apply to 2D graphics:
www.w3.org/TR/SVGTiny12/styling.html so we don't need to entirely re-inventing the wheel. On Mon, Jul 21, 2014 at 9:48 AM, jamesramm <jamessr...@gmail.com> wrote: > R Hattersley wrote > I'm not sure what it is about CSS syntax that isn't up to the job. For > example, SVG works with standard CSS syntax (see > http://www.w3.org/TR/SVG/styling.html#StylingWithCSS). Perhaps we just have > a different view of what constitutes CSS vs. HTML/SVG/whatever. The example > in the SVG spec is: > > rect { > fill: red; > stroke: blue; > stroke-width: 3 > } > > But if we define the element name for a Line2D instance as "line2d" then CSS > snippet could just become: > > line2d { > stroke: blue; > stroke-width: 3 > } > > You've just noted it: Line2D isn't a CSS selector..likewise, the properties > we want to call upon (like linewidth) are not CSS attributes. There are many > matplotlib properties that don't have an analogous CSS property/attribute > (that I know of); we might aswell define the mpl properties in our 'CSS' > subset. So we could base our language on CSS rules, but we need to define > new tokens. This means writing, or more likely, extending a parser. Not > huge, but not trivial. > > R Hattersley wrote > The DOM facade could help bridge the gap. For example, a "DOM" instance > returned by an Axes object could pretend to have "text" element children. > Styling those would route the style information back to the underlying Axes > object. For example: > > text { > font-size: 12pt; > } > > axes text.ylabel { > font-size: 10pt; > } > > This could be one way. Another way that would fit and I quite like is > similar to what is employed by mapnik/the tilemill, in that we simply have > nested declaration blocks, e.g: > > Axes { > gid: 'axes1'; > autoscalex_on: True; > ::ylabel { > text: 'Y-Axis'; > font-size: 10; > } > } > > I think this would be easier to parse and slightly clearer to read as it can > be 'attached' to the artist container it refers to (imagine if there were 2 > axes in a figure...). It is also easy to write in BNF, by just adding > another option to the Declaration block: > > Rule := Selector '{' [Declaration] '}' > > Declaration := Attribute':' Value';' | Rule > > ... > > But...small steps. I would start by introducing something for artist > primitives and for selectively applying to primitives using the gid > ________________________________ > View this message in context: Re: MEP26: Artist-level stylesheets > > Sent from the matplotlib - devel mailing list archive at Nabble.com. > > ------------------------------------------------------------------------------ > Want fast and easy access to all the code in your enterprise? Index and > search up to 200,000 lines of code with a free copy of Black Duck > Code Sight - the same software that powers the world's largest code > search on Ohloh, the Black Duck Open Hub! Try it now. > http://p.sf.net/sfu/bds > _______________________________________________ > Matplotlib-devel mailing list > Matplotlib-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel > -- Thomas Caswell tcasw...@gmail.com ------------------------------------------------------------------------------ Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck Code Sight - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel