The legend() docs state: 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.

The docs say this only in reference to autolegend capability (eg when

you call legend with no arguments). And this does work

import pylab as p

x = p.arange( 0,3, .1 )

p.plot( x, p.cos(x), label='cos(x)' )

p.plot( x, p.sin(x), label='sin(x)')

p.plot( x, 2*p.sin(x), label='_nolegend_' )

p.legend()

p.show()

It isn't really required in your use case, because you can simply pass

the lines and labels you want in the legend

import pylab as p

x = p.arange( 0,3, .1 )

l0, = p.plot( x, p.cos(x))

l1, = p.plot( x, p.sin(x))

l2, = p.plot( x, 2*p.sin(x))

p.legend((l0, l1), ('cos(x)', 'sin(x)') )

p.show()

It would not be too much work to support the semi-auto legending of

your example

p.legend( ( "cos(x)", "_nolegend_", "2*sin(x)" ) )

if you think this is sufficiently useful.

JDH