On Tue, Sep 16, 2008 at 4:09 PM, charles reid <[EMAIL PROTECTED]> wrote: > Hi there - > > I'm using the latest stable pylab/matplotlib (0.98.3) via OS X 10.5.4. I am > plotting a simple array of data, and I'm getting some strange behavior when > I try to add a legend to the plot. > First, the plot without the legend: > > f=figure(1) > title("Equilibrium Concentration vs. Equivalence Ratio") > line1 = plot(phi,xeq[1]) > show() > > This works fine. However, when I try to add a legend, I get an error. I > add this: > > f=figure(1) > title("Equilibrium Concentration vs. Equivalence Ratio") > line1 = plot(phi,xeq[1]) > f.legend(line1,('CO2'),loc=(0.8,0.8)) > show()
legend expects a sequence of strings ('CO2') is a string ('CO2',) is a length one sequence of strings ['CO2'] is also a length 1 sequence of strings When using parentheses to create a tuple, you must use a comma to disambiguate the alternative meaning of grouping. JDH ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users