color mix

Hello,

Attached is a small patch to add a simple color mix operation support.
For example, "red!30!white" mixes 30% of red with 70% of white. The
syntax is borrowed from latex xcolor package
(http://www.ukern.de/tex/xcolor.html).
I found it quite handy with the fancy box thing.

plt.text(0.6, 0.5, "test", size=50, rotation=30.,
         bbox = dict(boxstyle="round",
                     fc="orange!20!white", # 20% orange + 80% white
                     ec="orange!50!white", # 50 % orange + 50% white
                     )
         )

plt.text(0.5, 0.4, "test", size=50, rotation=-30.,
         bbox = dict(boxstyle="square",
                     fc="aqua!50!green!20!white",
                     ec="green!40!white",
                     )
         )

Any chance this could be included in matplotlib?
Regards,

-JJ

color_mix.png

color_mix.diff (1.38 KB)

That's a cool feature, and one I have not come across before.

I hesitate slightly because this it is non-standard (by that, I mean not available in a lot of "mainstream" formats like CSS, SVG etc.), but maybe that's just because they aren't as cool as matplotlib... :wink: The nice thing is that the "!" isn't meaningful in color strings at present, so this new syntax is at least unambiguous with anything pre-existing.

I'm for it, but would like to hear from others first.

Cheers,
Mike

Jae-Joon Lee wrote:

···

Hello,

Attached is a small patch to add a simple color mix operation support.
For example, "red!30!white" mixes 30% of red with 70% of white. The
syntax is borrowed from latex xcolor package
(http://www.ukern.de/tex/xcolor.html).
I found it quite handy with the fancy box thing.

plt.text(0.6, 0.5, "test", size=50, rotation=30.,
         bbox = dict(boxstyle="round",
                     fc="orange!20!white", # 20% orange + 80% white
                     ec="orange!50!white", # 50 % orange + 50% white
                     )
         )

plt.text(0.5, 0.4, "test", size=50, rotation=-30.,
         bbox = dict(boxstyle="square",
                     fc="aqua!50!green!20!white",
                     ec="green!40!white",
                     )
         )

Any chance this could be included in matplotlib?
Regards,

-JJ
  
------------------------------------------------------------------------

------------------------------------------------------------------------

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
------------------------------------------------------------------------

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

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

I like it too -- I only ask Jae-Joon that you make sure it is properly
documented, eg in the matplotlib.colors docstring. What would be
really nice would be a section in doc/users_guide on mpl colors....

JDH

···

On Thu, Sep 18, 2008 at 8:35 AM, Michael Droettboom <mdroe@...31...> wrote:

That's a cool feature, and one I have not come across before.

I hesitate slightly because this it is non-standard (by that, I mean not
available in a lot of "mainstream" formats like CSS, SVG etc.), but
maybe that's just because they aren't as cool as matplotlib... :wink: The
nice thing is that the "!" isn't meaningful in color strings at present,
so this new syntax is at least unambiguous with anything pre-existing.

I'm for it, but would like to hear from others first.

Thanks for the positive feedback!
Okay, I'll add a proper documentation for it and upload the patch again.

-JJ

···

On Thu, Sep 18, 2008 at 9:47 AM, John Hunter <jdh2358@...149...> wrote:

On Thu, Sep 18, 2008 at 8:35 AM, Michael Droettboom <mdroe@...31...> wrote:

That's a cool feature, and one I have not come across before.

I hesitate slightly because this it is non-standard (by that, I mean not
available in a lot of "mainstream" formats like CSS, SVG etc.), but
maybe that's just because they aren't as cool as matplotlib... :wink: The
nice thing is that the "!" isn't meaningful in color strings at present,
so this new syntax is at least unambiguous with anything pre-existing.

I'm for it, but would like to hear from others first.

I like it too -- I only ask Jae-Joon that you make sure it is properly
documented, eg in the matplotlib.colors docstring. What would be
really nice would be a section in doc/users_guide on mpl colors....

JDH