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

View: New views
3 Messages — Rating Filter:   Alert me  

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

by Greg Novak-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

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

by Jae-Joon Lee :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Nov 4, 2009 at 12:00 AM, Greg Novak <novak@...> 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

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

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

by Greg Novak-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...> wrote:

> On Wed, Nov 4, 2009 at 12:00 AM, Greg Novak <novak@...> 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
>

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users