Re: [Matplotlib-users] Matplotlib colors

2011-11-16 Thread Tony Yu
On Wed, Nov 16, 2011 at 5:35 PM, Jonno  wrote:

> I want to:
> 1. Have matplotlib assign the linecolor for a plot
> 2. Read the linecolor with .get_color()
> 3. Create another plot with the linecolor set to a lighter version of
> the previous linecolor.
>
> Ie:
>
> a, = plot(x,y)
> a.get_color() = 'b'
> b, = plot(x,y, color = "#xx")
>
> Since I'm only using the standard matplotlib assigned colors which
> cycle through b,g,r,c,m,y,k I thought I would just create a mapping
> between each color and a lighter version.
>
> How do I get the hex or RGB string for the base matplotlib colors?
>

There may be an easier way, but in the past I've used a color converter
object
(which seems unnecessarily verbose):

>>> import matplotlib.colors as mcolors
>>> cc = mcolors.ColorConverter()
>>> cc.to_rgb('b')
(0, 0, 1)



>
> Also, if there's a different property I can use to lighten the line
> color without changing the color that would be cool too.
>

If you have a white background (and no overlapping markers/lines), you
could just set the "alpha" argument in the plot command.

Best,
-Tony
--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Matplotlib colors

2011-11-16 Thread Jonno
I want to:
1. Have matplotlib assign the linecolor for a plot
2. Read the linecolor with .get_color()
3. Create another plot with the linecolor set to a lighter version of
the previous linecolor.

Ie:

a, = plot(x,y)
a.get_color() = 'b'
b, = plot(x,y, color = "#xx")

Since I'm only using the standard matplotlib assigned colors which
cycle through b,g,r,c,m,y,k I thought I would just create a mapping
between each color and a lighter version.

How do I get the hex or RGB string for the base matplotlib colors?

Also, if there's a different property I can use to lighten the line
color without changing the color that would be cool too.

Cheers,

Jonno.

--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib colors vs html colors

2010-04-14 Thread Peter Butterworth
On Thu, Apr 15, 2010 at 5:16 AM, Peter Butterworth  wrote:
> matlab colors seem to follow html :
> http://www.mathworks.com/access/helpdesk/help/techdoc/ref/colorspec.html

for c, m, y
but not for green, where matplotlib does follow html ...

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib colors vs html colors

2010-04-14 Thread Peter Butterworth
matlab colors seem to follow html :
http://www.mathworks.com/access/helpdesk/help/techdoc/ref/colorspec.html
I would agree that "yellow" is not very readable at all. Could
possibly the short-hand colors be made user configurable in
.matplotlibrc to suit individual taste ?

In any case, this issue needs to be mentioned in the documentation.



On Wed, Apr 14, 2010 at 9:58 PM, Eric Firing  wrote:
> John Hunter wrote:
>>
>> On Wed, Apr 14, 2010 at 2:14 PM, Jae-Joon Lee 
>> wrote:
>>
>>> John, the relevant code to define the "colors" attribute seems to be
>>> written by you. Maybe this is some matlab convention? Can you comment
>>> on this?
>>
>> The original color letters did come from matlab, and some of the color
>> RGB choices, like the background for the subplot gray, I got using a
>> color picker on my screen for maximum compatibility, but I do not
>> recall if that was the case for 'm', 'c'  and 'y'.  Most likely these
>> were the rgb values of the matlab colors.
>>
>> The html colors were submitted later by another user, and apparently
>> we never checked for consistency.   I think this is a wart, and I
>> don't feel strongly about keeping it or changing it for consistency in
>> the trunk ahead of 1.0 (it should remain as is on the branch).  If we
>> change it on the trunk, we should change the single letter codes to
>> correspond to the html full color name standards, rather than the
>> other way around.
>
> I would be cautious about making this change. At least on my laptop screen,
> with the default white axes background, the single-letter colors show up
> better than the html versions.  It makes sense to me for the single-letter
> colors to be chosen for good visibility and contrast in actual use, not for
> consistency with the html names.  In fact, I see no good argument for
> consistency in this case.
>
> Eric
>
>
>>
>> JDH



-- 
thanks,
peter butterworth

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib colors vs html colors

2010-04-14 Thread Eric Firing
John Hunter wrote:
> On Wed, Apr 14, 2010 at 2:14 PM, Jae-Joon Lee  wrote:
> 
>> John, the relevant code to define the "colors" attribute seems to be
>> written by you. Maybe this is some matlab convention? Can you comment
>> on this?
> 
> The original color letters did come from matlab, and some of the color
> RGB choices, like the background for the subplot gray, I got using a
> color picker on my screen for maximum compatibility, but I do not
> recall if that was the case for 'm', 'c'  and 'y'.  Most likely these
> were the rgb values of the matlab colors.
> 
> The html colors were submitted later by another user, and apparently
> we never checked for consistency.   I think this is a wart, and I
> don't feel strongly about keeping it or changing it for consistency in
> the trunk ahead of 1.0 (it should remain as is on the branch).  If we
> change it on the trunk, we should change the single letter codes to
> correspond to the html full color name standards, rather than the
> other way around.

I would be cautious about making this change. At least on my laptop 
screen, with the default white axes background, the single-letter colors 
show up better than the html versions.  It makes sense to me for the 
single-letter colors to be chosen for good visibility and contrast in 
actual use, not for consistency with the html names.  In fact, I see no 
good argument for consistency in this case.

Eric


> 
> JDH
> 
> --
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib colors vs html colors

2010-04-14 Thread John Hunter
On Wed, Apr 14, 2010 at 2:14 PM, Jae-Joon Lee  wrote:

> John, the relevant code to define the "colors" attribute seems to be
> written by you. Maybe this is some matlab convention? Can you comment
> on this?

The original color letters did come from matlab, and some of the color
RGB choices, like the background for the subplot gray, I got using a
color picker on my screen for maximum compatibility, but I do not
recall if that was the case for 'm', 'c'  and 'y'.  Most likely these
were the rgb values of the matlab colors.

The html colors were submitted later by another user, and apparently
we never checked for consistency.   I think this is a wart, and I
don't feel strongly about keeping it or changing it for consistency in
the trunk ahead of 1.0 (it should remain as is on the branch).  If we
change it on the trunk, we should change the single letter codes to
correspond to the html full color name standards, rather than the
other way around.

JDH

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib colors vs html colors

2010-04-14 Thread Jae-Joon Lee
On Sun, Apr 11, 2010 at 12:40 PM, Peter Butterworth  wrote:
> sorry if this has been covered before, but I must say I've found the
> following quite confusing :
> color="cyan" is not in fact equivalent to color='c'
>
>
> in colors.py  :
>
> Commands which take color arguments can use several formats to specify
> the colors.  For the basic builtin colors, you can use a single letter
>
>    - b  : blue
>    - g  : green
>    - r  : red
>    - c  : cyan
>    - m  : magenta
>    - y  : yellow
>    - k  : black
>    - w  : white
>
> in ColorConverter :
>    colors = {
>        'b' : (0.0, 0.0, 1.0),
>        'g' : (0.0, 0.5, 0.0),
>        'r' : (1.0, 0.0, 0.0),
>        'c' : (0.0, 0.75, 0.75),
>        'm' : (0.75, 0, 0.75),
>        'y' : (0.75, 0.75, 0),
>        'k' : (0.0, 0.0, 0.0),
>        'w' : (1.0, 1.0, 1.0),
>        }
>
> we are told 'c' is short for cyan. Yet color="cyan" is not equivalent
> to color='c'
>   'cyan'                 : '#00'
>
> In [50]: rgb2hex((0.0, 0.75, 0.75))
> Out[50]: '#00bfbf'
>

Thank you for reporting.

It seems that it is not just "c", but the rgb values of "m" and "y"
are also different.


In [26]: cc.to_rgb("magenta")
Out[26]: (1.0, 0.0, 1.0)

In [27]: cc.to_rgb("m")
Out[27]: (0.75, 0, 0.75)



In [30]: cc.to_rgb("yellow")
Out[30]: (1.0, 1.0, 0.0)

In [31]: cc.to_rgb("y")
Out[31]: (0.75, 0.75, 0)


John, the relevant code to define the "colors" attribute seems to be
written by you. Maybe this is some matlab convention? Can you comment
on this?

Regards,

-JJ



> --
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] matplotlib colors vs html colors

2010-04-11 Thread Peter Butterworth
sorry if this has been covered before, but I must say I've found the
following quite confusing :
color="cyan" is not in fact equivalent to color='c'


in colors.py  :

Commands which take color arguments can use several formats to specify
the colors.  For the basic builtin colors, you can use a single letter

- b  : blue
- g  : green
- r  : red
- c  : cyan
- m  : magenta
- y  : yellow
- k  : black
- w  : white

in ColorConverter :
colors = {
'b' : (0.0, 0.0, 1.0),
'g' : (0.0, 0.5, 0.0),
'r' : (1.0, 0.0, 0.0),
'c' : (0.0, 0.75, 0.75),
'm' : (0.75, 0, 0.75),
'y' : (0.75, 0.75, 0),
'k' : (0.0, 0.0, 0.0),
'w' : (1.0, 1.0, 1.0),
}

we are told 'c' is short for cyan. Yet color="cyan" is not equivalent
to color='c'
   'cyan' : '#00'

In [50]: rgb2hex((0.0, 0.75, 0.75))
Out[50]: '#00bfbf'

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users