On 7/20/07, Gael Varoquaux <[EMAIL PROTECTED]> wrote: > This question really belongs to the user ML, but I don't want to > subscribe to another ML, so please, indulge me. > > I often have a figure with a lot of plot, some of them created in a for > loop. I want some of them to display in the legend, and some of them not > to. Now this is possible, using the two positionnal argument form of > "legend", but this means I have to keep trak of all the plots created, > and of the associated label. Is there a way to specify that a plot should > not have a legend when creating it. Something like "plot( ..., > label=False)" would be great. > > If not, would it be possible to have such a feature ?
In recent mpl, label='' should do it. In order versions, label='_nolegend_' >From the legend docstring: USAGE: Make a legend with existing lines >>> legend() legend by itself will try and build a legend using the label property of the lines/patches/collections. You can set the label of a line by doing plot(x, y, label='my data') or line.set_label('my data'). If label is set to '_nolegend_', the item will not be shown in legend. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel