You may use a proxy artist. http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist
for example, from matplotlib.lines import Line2D l1 = Line2D([], [], linewidth=3, color="r") l2 = Line2D([], [], linewidth=3, color="g") l3 = Line2D([], [], linewidth=3, color="b") legend([l1, l2, l3], ["label 1", "label 2", "label 3"]) Regards, -JJ On Wed, Aug 17, 2011 at 1:24 AM, Ravi Kanth Vanapalli <vvnrk.vanapa...@gmail.com> wrote: > Hi , > > I wish to add a custom legend to a multicolored line drawn using matplotlib > as shown in the figure below > http://www.scipy.org/Cookbook/Matplotlib/MulticoloredLine > I tried exploring the legend but somehow couldn't figure out its usage and > how to adapt it to multicolored line as in the above link > I need to use say Red line for label1 and blue line for label2 and green > line for label3. All the three colors are a part of a single sinusoidal wave > as in the above link. > Any thoughts/ideas/suggestions which could provide me some direction on this > would be highly appreciated. > > -- > Thanks and Regards, > RaviKanth > > ------------------------------------------------------------------------------ > uberSVN's rich system and user administration capabilities and model > configuration take the hassle out of deploying and managing Subversion and > the tools developers use with it. Learn more about uberSVN and get a free > download at: http://p.sf.net/sfu/wandisco-dev2dev > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > ------------------------------------------------------------------------------ Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users