On Feb 7, 2008 8:21 AM, Reckoner <[EMAIL PROTECTED]> wrote: > is it possible to use matplotlib's legend() for a bar chart? I am plotting > a number of bars with different colors on the same axes and I would like to > label each color. > > legend () seems to want to label every single bar on my bar chart.
yes, see http://matplotlib.sf.net/examples/barchart_demo.py In a nutshell, bar returns a list of rectangle objects, and you need to pass a proxy element of this list (eg the first element) to the legend command. JDH ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users