Incidentally, if anyone else wants to do this and is unable to update their matplotlib to v1.2.0, this code snippet achieves the same effect.
####################################### import numpy as np import matplotlib.pyplot as plt from matplotlib.collections import LineCollection # the line to plot x = np.linspace(0,1,101) y = x*0.5-0.25 scaling = np.exp(-(x-0.5)**2/0.5**2) # scale the transparency of the line according to this points = np.array([x, y]).T.reshape(-1, 1, 2) segments = np.concatenate([points[:-1], points[1:]], axis=1) smin = scaling.min() smax = scaling.max() # inline function to convert scaling value to alpha value in [0,1] alpha = lambda s0: (s0-smin)/(smax-smin) # create a (r,g,b,a) color description for each line segment cmap = [] for a in segments: # the x-value for this segment is: x0 = a.mean(0)[0] # so it has a scaling value of: s0 = np.interp(x0,x,scaling) # and it has an alpha value of: a0 = alpha(s0) cmap.append([0.0,0.0,0.0,a0]) # Create the line collection object, and set the color parameters. lc = LineCollection(segments) lc.set_color(cmap) ax = plt.subplot(111) ax.add_collection(lc) ax.set_xlim(x.min(), x.max()) ax.set_ylim(y.min(), y.max()) plt.show() ####################################### ------------------------------------------------------------------------------ LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users