Multicolor line with dates

Hi all,

I'm relatively new to matplotlib but have been generating some plots without too much trouble over the last couple of weeks. Now I'm getting trickier...

I have a timeseries plot that plots a few values against an x-axis of dates. I *really* want to have my key line change color to red when the values are *critical* but am having no success working with the examples I can find. It appears that with dates as an x-axis, something else needs to happen.

Here is the code:

# prep for multicolored line <-- here I simply generate the list of required color values
r = colorConverter.to_rgba('r')
b = colorConverter.to_rgba('black')
color = list()
for f in daily_fvfm:
   if f <= -0.4:

# create the linecollection
points = zip(date_range, daily_fvfm)
segments = zip(points[:-1], points[1:])
lc = LineCollection(segments, colors = color) <--- here is where I get the error at run-time (see below)

# create a figure with two subplots and add a
# second axis to the first figure

fig = mpl.figure(1)
ax1 = fig.add_subplot(211)
ax2 = ax1.twinx()

ax3 = fig.add_subplot(212)

# plot the sst and then the par
ax1.plot(date_range[start_index:end_index], daily_sst[start_index:end_index], 'b-')
ax1.plot(date_range[start_index:end_index], daily_par[start_index:end_index], color='darkgoldenrod')

# then plot Fv/Fm
#ax2.plot(date_range[start_index:end_index], daily_fvfm[start_index:end_index], lw='2', color='black')

Traceback (most recent call last):
   File "", line 87, in <module>
     lc = LineCollection(segments, colors = color)
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/", line 926, in __init__
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/", line 938, in set_segments
     seg = np.asarray(seg, np.float_)
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/numpy/core/", line 230, in asarray
     return array(a, dtype, copy=False, order=order)
ValueError: setting an array element with a sequence.

Can a multicolor line be done with dates. if so, what is the manipulation I need to do for dates?

Tim Burgess