figlegend

I still have a bit of a problem. This puts the legend

    > "more or less" outside the plot. If I use "upper right"
    > with only two lines it is o.k., however if I use
    > e.g. "center right" then about half of the legend is still
    > over the top of the plot.

I think the best approach is to use fig.add_axes rather than
fig.add_subplot to create your axes. Then you can make it the exact
size you want. You can also place the figure legend anywhere you want
by using loc=(x,y) instead of a location string. I just noticed this
was undocumented :-(. It *is* documented for the axes legend, and
I'll fix the figure legend docstring for the next release.

Here's a little example

    import pylab as p
    fig = p.figure()
    ax = fig.add_axes([0.1, 0.3, 0.4, 0.4])

    lines = ax.plot([1,2,3])
    fig.legend(lines, ('hi', ), loc=(0.6, 0.6))
    p.show()

Hope this helps,
JDH

Hi John,

John Hunter wrote:

"Werner" == Werner F Bruhin <werner.bruhin@...185...> writes:

    > I still have a bit of a problem. This puts the legend
    > "more or less" outside the plot. If I use "upper right"
    > with only two lines it is o.k., however if I use
    > e.g. "center right" then about half of the legend is still
    > over the top of the plot.

I think the best approach is to use fig.add_axes rather than
fig.add_subplot to create your axes.

Pitty that I can't have both. But I'll worry about this one when I actually do make use of the subplots.

   Then you can make it the exact

size you want. You can also place the figure legend anywhere you want
by using loc=(x,y) instead of a location string. I just noticed this
was undocumented :-(.

You think I would have found it:)

  It *is* documented for the axes legend, and

I'll fix the figure legend docstring for the next release.

Here's a little example

    import pylab as p
    fig = p.figure()
    ax = fig.add_axes([0.1, 0.3, 0.4, 0.4])

    lines = ax.plot([1,2,3])
    fig.legend(lines, ('hi', ), loc=(0.6, 0.6))
    p.show()

Hope this helps,
JDH

Thanks, yes this did help!
Werner

···

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click