Thanks for a response, but unfortunately it doesn't seem to work. I have
some sample code on pastebin http://pastebin.com/W6JmbCsz in case the
following does not email out well
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 12 11:16:03 2012
Using the current stable version of pythonxy on Windows 7 32bit
Author: Jonathan
Notice how the figure box is not placed correctly, effectively missing the
legend entirely
"""
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(-2*np.pi, 2*np.pi, 0.1)
fig = plt.figure(1, figsize=(8,6))
ax = fig.add_subplot(111)
ax.plot(x, np.sin(x), label='Sine')
ax.plot(x, np.cos(x), label='Cosine')
ax.plot(x, np.arctan(x), label='Inverse tan')
handles, labels = ax.get_legend_handles_labels()
lgd = ax.legend(handles, labels, loc=9, bbox_to_anchor=(0.5,-0.1))
ax.grid('on')
#fig.tight_layout()
fig.savefig('samplefigure', bbox_extra_artists=(lgd,), bbox='tight')
On Thu, Apr 12, 2012 at 11:51 PM, Benjamin Root <ben.r...@ou.edu> wrote:
>
>
> On Thu, Apr 12, 2012 at 2:05 AM, Jonathan Bruck <jdt.br...@gmail.com>wrote:
>
>> Hi all,
>>
>> Forgive me as this is the first time I've posted here. I've asked a
>> question on StackOverFlow:
>>
>>
>> http://stackoverflow.com/questions/10101700/moving-matplotlib-legend-outside-of-the-axis-makes-it-cutoff-by-the-figure-box#comment12952803_10101700
>>
>> The question relates to adjusting the size of the figure box to
>> accommodate a large legend when the legend is placed below instead of on
>> top of the axes.
>>
>> I thought I'd post here to see if there are any other answers to avoiding
>> having the figure box cut off the bottom of the legend.
>>
>> Thanks
>>
>> Jonathan
>> --
>> There are no passengers on Spaceship Earth. We are all crew.
>>
>> E: jdt.br...@gmail.com
>>
>>
> If you only care about saving the figure, the savefig() method can take
> bbox='tight' and bbox_extra_artists=[legnd_obj] arguments (assuming you
> save the legend to such a variable. As for on-screen displays, I have yet
> to find a solution.
>
> Ben Root
>
>
--
There are no passengers on Spaceship Earth. We are all crew.
Jonathan Bruck
E: jdt.br...@gmail.com
Mob: 0421188951
Bachelor of Engineering (Mechanical, Biomedical), Bachelor of Medical
Science
--
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users