legend

Hello Nicolas

    >> Another strange thing I remark is:
    >>
    >> if you are doing:
    >>
    >> plot([1,2],[4,5]) legend(('toto'))
    >>
    >> the text for the legend is vertical and not horizontal, that's
    >> work normally when we are using more than one argument.
    > This happens because ('toto') is not a one-element list
    > but a string. If you write

    > plot([1,2],[4,5]) legend(('toto',))

    > instead it works as expected.

This is such a common mistake I think we should special case string
input for the labels and make it a len(1) tuple

   if is_string_like(labels): labels = (labels, )

All opposed, say nay!

JDH

···

On Wed, Dec 01, 2004 at 09:34:51AM -0500, Humufr wrote:

Hi John,

I just recuperate the cvs and I saw that you correct a lot of things inside the legend, thanks very much.

you will hate me soon I think :slight_smile: but I found one bug and onething I don't like too much:

1)

the bug:

I tried:

plot([1,2],[4,5],'g^',markersize=4,label='1')
errorbar([1,4],[6,7],[1,1],fmt='bh',markersize=4,label='4')

#plot([3,4],[6,7])

legend()

show()

and there are a problem with errorbar and the label and the legend. Different line appeard and at the end we have only the good symbols)

2)

I add the line: plot([3,4],[6,7]) only to show you that even if the plot command doesn't have a label the legend give a place for it. I think at two solution to solve this (perhaps it's already implemented and I didn't find...):

- by default if there are some label with the plot command the plot command without are not take in count to create the legend

- add something like: label=None to indicate the the user don't want this line in the legend.

Thanks again to have found and correct all this bug so fast, I'm very impressed :slight_smile:

Nicolas