In the past, I've thought having some sort of "HTML-lite" subset would be the most powerful here.  So one could do:

   title("This is <b>bold</b>")

Strictly speaking, for colors, one would do:

   title("This is <font color='red'>red</font>")

but that's awfully verbose.  I wouldn't have a problem fudging the spec and supporting:

   title("This is <red>red</red>")

since this would never be full-fledged HTML anyway [1].

The advantage of this approach over any of the list-based ones is that different properties can be nested, and I think most people understand the basics of HTML/XML tags.

And I agree with Benjamin, that this should be at the Text() constructor level so it works everywhere.  I envision it being a sort of peer text parser just as the mathtext parser is now -- in fact a lot of the mathtext machinery would be reused.

[1] Of course, I've also considered using something like PythonWebKit to render text for us -- the advantage being we'd also get proper bidi and other internationalization features.  But (a) WebKit is another honking dependency and (b) I'm not sure the Python bindings are ready for prime time.

Mike

On 02/07/2012 02:46 PM, Benjamin Root wrote:


On Tue, Feb 7, 2012 at 1:15 PM, Gökhan Sever <gokhansever@gmail.com> wrote:
I was basing my whitespace split idea on single string assumption --eg. no list passing.

I do not have a strong preference on the final argument passing, as long as it works instead of manually placing the texts on figure or axis :)



On Tue, Feb 7, 2012 at 11:52 AM, Ryan May <rmay31@gmail.com> wrote:
On Tue, Feb 7, 2012 at 12:49 PM, Gökhan Sever <gokhansever@gmail.com> wrote:
> This works as well, as long as it functions :)
>
> My idea requires little less typing. But forgot previously, text string
> should be whitespace split.

Right, but we shouldn't guess. If we automatically split on
whitespace, this becomes harder:

plt.ylabel(["The sun is", "yellow"], ['k', 'y'])

Ryan


I think the python mantra of "explicit over implicit" should be followed here.  I don't think we currently allow list of strings, so there is no risk of breaking existing scripts, I think.  We probably should confirm that just in case.

Also, how deep should this rabbit hole go?  I could imagine one could want this for title() and figtitle().  Maybe it would be best to implement this at the Text() constructor level?

Ben Root



------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d


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