From: John H. <jdh...@ac...> - 2005-04-11 14:00:57
|
>>>>> "Werner" == Werner F Bruhin <wer...@fr...> writes: Werner> I still have a bit of a problem. This puts the legend Werner> "more or less" outside the plot. If I use "upper right" Werner> with only two lines it is o.k., however if I use Werner> e.g. "center right" then about half of the legend is still Werner> 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 |