Error in mpl.axes.set_default_color_cycle

Hi,

I have an error while trying to use mpl.axes.set_default_color_cycle to define my own color cycle based on the set1 colormap:

In [1]: set1 = array([[228,55, 77, 152,255,255,166,247,153],
    ...: [26, 126,175,78, 127,255,86, 129,153],
    ...: [28, 184,74, 163,0, 51, 40, 191,153]],'d').T / 255.

In [2]: mpl.axes.set_default_color_cycle(set1)

···

---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)

/autofs/home/ycopin/<ipython console> in <module>()

/usr/lib/python2.5/site-packages/matplotlib/axes.py in set_default_color_cycle(clist)
     113 """
     114 _process_plot_var_args.defaultColors = clist[:]
--> 115 rcParams['lines.color'] = clist[0]
     116
     117 class _process_plot_var_args:

/usr/lib/python2.5/site-packages/matplotlib/__init__.pyc in __setitem__(self, key, val)
     588 instead.'% (key, alt))
     589 key = alt
--> 590 cval = self.validate[key](val)
     591 dict.__setitem__(self, key, cval)
     592 except KeyError:

/usr/lib/python2.5/site-packages/matplotlib/rcsetup.pyc in validate_color(s)
     156 def validate_color(s):
     157 'return a valid color arg'
--> 158 if s.lower() == 'none':
     159 return 'None'
     160 if is_color_like(s):

AttributeError: 'numpy.ndarray' object has no attribute 'lower'

I'm using matplotlib 0.98.3 but I checked on the SVN repository that the offending lines ("rcParams['lines.color'] = clist[0]","if s.lower() == 'none'") are still there.

Cheers.
--
    .~. Yannick COPIN (o:>* Doctus cum libro
    /V\ Institut de physique nucleaire de Lyon (IN2P3-France)
   // \\ Lawrence Berkeley National Laboratory
  /( )\ aim:YnCopin icq:236931013 http://snovae.in2p3.fr/ycopin/
   ^`~'^

Yannick Copin wrote:

Hi,

I have an error while trying to use mpl.axes.set_default_color_cycle to define my own color cycle based on the set1 colormap:

In [1]: set1 = array([[228,55, 77, 152,255,255,166,247,153],
    ...: [26, 126,175,78, 127,255,86, 129,153],
    ...: [28, 184,74, 163,0, 51, 40, 191,153]],'d').T / 255.

In [2]: mpl.axes.set_default_color_cycle(set1)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)

I just committed a change that should fix this bug.

Eric

···

/autofs/home/ycopin/<ipython console> in <module>()

/usr/lib/python2.5/site-packages/matplotlib/axes.py in set_default_color_cycle(clist)
     113 """
     114 _process_plot_var_args.defaultColors = clist[:]
--> 115 rcParams['lines.color'] = clist[0]
     116
     117 class _process_plot_var_args:

/usr/lib/python2.5/site-packages/matplotlib/__init__.pyc in __setitem__(self, key, val)
     588 instead.'% (key, alt))
     589 key = alt
--> 590 cval = self.validate[key](val)
     591 dict.__setitem__(self, key, cval)
     592 except KeyError:

/usr/lib/python2.5/site-packages/matplotlib/rcsetup.pyc in validate_color(s)
     156 def validate_color(s):
     157 'return a valid color arg'
--> 158 if s.lower() == 'none':
     159 return 'None'
     160 if is_color_like(s):

AttributeError: 'numpy.ndarray' object has no attribute 'lower'

I'm using matplotlib 0.98.3 but I checked on the SVN repository that the offending lines ("rcParams['lines.color'] = clist[0]","if s.lower() == 'none'") are still there.

Cheers.