Legend fails to make sample symbols for legends outside of the plot area

Hello,
I am making a plot with a _lot_ of lines. There's no place within the
plot itself that the legend will fit without blocking anything. I
tried to put the legend outside the plot area by passing a tuple to
loc. This worked, but lines that are marked with symbols don't get
any sample line in the legend. That is:

subplots_adjust(right=0.7); draw()
xs=linspace(0,1,30);

clf(); plot(xs,xs**2, '^',label='data'); legend(loc=(0.8,0.1)); draw()

This works as expected, except the legend is inside the plot area

clf(); plot(xs,xs**2, '^',label='data'); legend(loc=(1.1,0.1)); draw()

This puts the legend in the right place (outside the plot area), but
the area to the left of 'data' in the legend (where the sample line
usually goes) is blank.

clf(); plot(xs,xs**2, '^',label='data'); legend(loc=(0.93,0.1)); draw()

This half draws one of the symbols that make up the sample inside the
legend. This seems to indicate that matplotlib will only draw symbols
when they lie inside a plot.

Is this the intended behavior? How can I get complete sample lines
when the legend lies outside the plot area?

Thank you,
Greg

No, this is not intended.
It seems to me that wrong clip path is set for those legend handles.
However, your code works fine with the svn version of mpl and also
with the 0.99.1.
So, maybe this is an old bug that has been fixed.
Can you check your matplotlib version and, if possible, update to newer version?
Or, if you report your version of mpl, I'll see if I can find any workaround.

-JJ

···

On Wed, Nov 4, 2009 at 12:00 AM, Greg Novak <novak@...354...> wrote:

Is this the intended behavior? How can I get complete sample lines
when the legend lies outside the plot area?

Indeed, my version is 98.3. I'll update. Thanks!
Greg

···

On Wed, Nov 4, 2009 at 9:03 AM, Jae-Joon Lee <lee.j.joon@...287...> wrote:

On Wed, Nov 4, 2009 at 12:00 AM, Greg Novak <novak@...354...> wrote:

Is this the intended behavior? How can I get complete sample lines
when the legend lies outside the plot area?

No, this is not intended.
It seems to me that wrong clip path is set for those legend handles.
However, your code works fine with the svn version of mpl and also
with the 0.99.1.
So, maybe this is an old bug that has been fixed.
Can you check your matplotlib version and, if possible, update to newer version?
Or, if you report your version of mpl, I'll see if I can find any workaround.

-JJ