Re: [Matplotlib-users] Partial coloring of text in matplotlib

2012-02-08 Thread Jae-Joon Lee
What can be done with the current Matplotlib is to use the offset boxes. Here is a modified version of a code snippet from http://abitofpythonabitofastronomy.blogspot.com/2009/05/mpl-multicolor-text.html Regards, -JJ from matplotlib.offsetbox import HPacker, TextArea, AnnotationBbox f =

Re: [Matplotlib-users] Partial coloring of text in matplotlib

2012-02-08 Thread Gökhan Sever
This is the solution which requires the least modification to the original text inserting functions. The only drawback is like you said, it only works with ps backend. Any idea if this could be generalized for other backends? On Tue, Feb 7, 2012 at 3:44 PM, Yann Tambouret yannp...@bu.edu wrote:

[Matplotlib-users] Partial coloring of text in matplotlib

2012-02-07 Thread Gökhan Sever
Is there a way in matplotlib to partially specify the color of a string? Example: plt.ylabel(Today is cloudy.) How can I show today as red, is as green and cloudy. as blue? Thanks. PS: Asked also on http://stackoverflow.com/questions/9169052/partial-coloring-of-text-in-matplotlib -- Gökhan

Re: [Matplotlib-users] Partial coloring of text in matplotlib

2012-02-07 Thread Michael Droettboom
Nope. But it's something I've wanted to add for a while. Can you file an Issue in the github tracker? Mike On 02/07/2012 11:40 AM, Gökhan Sever wrote: Is there a way in matplotlib to partially specify the color of a string? Example: plt.ylabel(Today is cloudy.) How can I show today as

Re: [Matplotlib-users] Partial coloring of text in matplotlib

2012-02-07 Thread Gökhan Sever
Posted at https://github.com/matplotlib/matplotlib/issues/697 I think a syntax like: plt.ylabel(Sun is shining., color='rgb') would be a good start. (Assuming len of string == len of colors) On Tue, Feb 7, 2012 at 11:18 AM, Michael Droettboom md...@stsci.edu wrote: Nope. But it's something

Re: [Matplotlib-users] Partial coloring of text in matplotlib

2012-02-07 Thread Benjamin Root
On Tue, Feb 7, 2012 at 12:38 PM, Gökhan Sever gokhanse...@gmail.com wrote: Posted at https://github.com/matplotlib/matplotlib/issues/697 I think a syntax like: plt.ylabel(Sun is shining., color='rgb') would be a good start. (Assuming len of string == len of colors) Don't know if I like

Re: [Matplotlib-users] Partial coloring of text in matplotlib

2012-02-07 Thread Gökhan Sever
This works as well, as long as it functions :) My idea requires little less typing. But forgot previously, text string should be whitespace split. On Tue, Feb 7, 2012 at 11:43 AM, Benjamin Root ben.r...@ou.edu wrote: On Tue, Feb 7, 2012 at 12:38 PM, Gökhan Sever gokhanse...@gmail.comwrote:

Re: [Matplotlib-users] Partial coloring of text in matplotlib

2012-02-07 Thread Ryan May
On Tue, Feb 7, 2012 at 12:49 PM, Gökhan Sever gokhanse...@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,

Re: [Matplotlib-users] Partial coloring of text in matplotlib

2012-02-07 Thread Gökhan Sever
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 rma...@gmail.com

Re: [Matplotlib-users] Partial coloring of text in matplotlib

2012-02-07 Thread Benjamin Root
On Tue, Feb 7, 2012 at 1:15 PM, Gökhan Sever gokhanse...@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

Re: [Matplotlib-users] Partial coloring of text in matplotlib

2012-02-07 Thread Gökhan Sever
On Tue, Feb 7, 2012 at 12:46 PM, Benjamin Root ben.r...@ou.edu wrote: On Tue, Feb 7, 2012 at 1:15 PM, Gökhan Sever gokhanse...@gmail.comwrote: 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

Re: [Matplotlib-users] Partial coloring of text in matplotlib

2012-02-07 Thread Michael Droettboom
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 bbold/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

Re: [Matplotlib-users] Partial coloring of text in matplotlib

2012-02-07 Thread Jason Grout
On 2/7/12 2:47 PM, Michael Droettboom wrote: since this would never be full-fledged HTML anyway [1]. Famous last words, right? I'm curious: for the SVG backend, or a possible html5 canvas backend, can we already include html? I don't know, but I'm curious. Jason

Re: [Matplotlib-users] Partial coloring of text in matplotlib

2012-02-07 Thread Paul Ivanov
Benjamin Root, on 2012-02-07 13:46, wrote: 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? For this reason, I would discourage even implementing such

Re: [Matplotlib-users] Partial coloring of text in matplotlib

2012-02-07 Thread Yann Tambouret
Along the lines of Mike's suggestion, I thought this could be done using Latex. I posted an answer on SO with an example of doing this, but it seems only to work with postscript backend. Other backends override the color with the mpl text color setting. Is there a way to prevent this override?