Re: [Matplotlib-users] Stopping Legend From Overlapping the Graph
Awesome, thanks. That works perfectly. Chris On Sun, Jun 28, 2009 at 12:16 AM, Jae-Joon Leelee.j.j...@gmail.com wrote: sorry. As guillaume has mentioned, you need to install mpl from svn. Here is some workaround you can try. I guess it would work with 0.98.5.3. Basically, you create a separate axes for a legend. ax1 = axes([0.1, 0.2,0.8, 0.7]) p1, = ax1.plot([1,2,3]) p2, = ax1.plot([3,2,1]) ax2 = axes([0.1, 0.1, 0.8, 0.01], frameon=False) ax2.xaxis.set_visible(False) ax2.yaxis.set_visible(False) l = ax2.legend([p1, p2], [Legend1, Legend2], mode=expand, ncol=2, borderaxespad=0.) -JJ On Sat, Jun 27, 2009 at 6:00 PM, Chris Spencerchriss...@gmail.com wrote: Thanks. Is that some sort of blending edge feature? I just installed 0.98.5.3, but the sample code gives me the error: TypeError: __init__() got an unexpected keyword argument 'bbox_to_anchor' On Thu, Jun 25, 2009 at 10:20 PM, Jae-Joon Leelee.j.j...@gmail.com wrote: The linked page below shows how you put the legend above the graph. http://matplotlib.sourceforge.net/users/plotting/legend.html#legend-location You can put it below the axes by adjusting the bbox_to_anchor parameter. Try something like bbox_to_anchor=(0., -0.1, 1., -0.1), loc=1 Make sure to adjust the suplot parameter (or axes location) to make enough room for the legend. -JJ On Thu, Jun 25, 2009 at 9:22 PM, Chris Spencerchriss...@gmail.com wrote: How do you show the legend below the graph, so it doesn't overlap at all with the graph? The docs for the legend() loc parameter only seem to specify where *on* the graph you want it to show, which is driving me nuts because even using best, it usually hides some of my data. I want to see *all* of my graph, as well as the legend. Is there any way to do this with pylab? Any help is appreciated. Chris -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Stopping Legend From Overlapping the Graph
Thanks. Is that some sort of blending edge feature? I just installed 0.98.5.3, but the sample code gives me the error: TypeError: __init__() got an unexpected keyword argument 'bbox_to_anchor' On Thu, Jun 25, 2009 at 10:20 PM, Jae-Joon Leelee.j.j...@gmail.com wrote: The linked page below shows how you put the legend above the graph. http://matplotlib.sourceforge.net/users/plotting/legend.html#legend-location You can put it below the axes by adjusting the bbox_to_anchor parameter. Try something like bbox_to_anchor=(0., -0.1, 1., -0.1), loc=1 Make sure to adjust the suplot parameter (or axes location) to make enough room for the legend. -JJ On Thu, Jun 25, 2009 at 9:22 PM, Chris Spencerchriss...@gmail.com wrote: How do you show the legend below the graph, so it doesn't overlap at all with the graph? The docs for the legend() loc parameter only seem to specify where *on* the graph you want it to show, which is driving me nuts because even using best, it usually hides some of my data. I want to see *all* of my graph, as well as the legend. Is there any way to do this with pylab? Any help is appreciated. Chris -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Stopping Legend From Overlapping the Graph
sorry. As guillaume has mentioned, you need to install mpl from svn. Here is some workaround you can try. I guess it would work with 0.98.5.3. Basically, you create a separate axes for a legend. ax1 = axes([0.1, 0.2,0.8, 0.7]) p1, = ax1.plot([1,2,3]) p2, = ax1.plot([3,2,1]) ax2 = axes([0.1, 0.1, 0.8, 0.01], frameon=False) ax2.xaxis.set_visible(False) ax2.yaxis.set_visible(False) l = ax2.legend([p1, p2], [Legend1, Legend2], mode=expand, ncol=2, borderaxespad=0.) -JJ On Sat, Jun 27, 2009 at 6:00 PM, Chris Spencerchriss...@gmail.com wrote: Thanks. Is that some sort of blending edge feature? I just installed 0.98.5.3, but the sample code gives me the error: TypeError: __init__() got an unexpected keyword argument 'bbox_to_anchor' On Thu, Jun 25, 2009 at 10:20 PM, Jae-Joon Leelee.j.j...@gmail.com wrote: The linked page below shows how you put the legend above the graph. http://matplotlib.sourceforge.net/users/plotting/legend.html#legend-location You can put it below the axes by adjusting the bbox_to_anchor parameter. Try something like  bbox_to_anchor=(0., -0.1, 1., -0.1), loc=1 Make sure to adjust the suplot parameter (or axes location) to make enough room for the legend. -JJ On Thu, Jun 25, 2009 at 9:22 PM, Chris Spencerchriss...@gmail.com wrote: How do you show the legend below the graph, so it doesn't overlap at all with the graph? The docs for the legend() loc parameter only seem to specify where *on* the graph you want it to show, which is driving me nuts because even using best, it usually hides some of my data. I want to see *all* of my graph, as well as the legend. Is there any way to do this with pylab? Any help is appreciated. Chris -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Stopping Legend From Overlapping the Graph
I forgot to CC the list :S and I updated to svn trunk and it now works fine :) guillaume ranquet wrote: this question raised my interest and I tried It. unfortunately, I get errors :( when executing the demo source code linked, I get $ python ~/testmpl.py Traceback (most recent call last): File /home/granquet/testmpl.py, line 7, in module ncol=2, mode=expand, borderaxespad=0.) File /usr/lib/python2.6/site-packages/matplotlib/pyplot.py, line 2447, in legend ret = gca().legend(*args, **kwargs) File /usr/lib/python2.6/site-packages/matplotlib/axes.py, line 3823, in legend self.legend_ = mlegend.Legend(self, handles, labels, **kwargs) TypeError: __init__() got an unexpected keyword argument 'bbox_to_anchor' I tried with a .set_bbox_to_anchor() but I get: AttributeError: 'Legend' object has no attribute 'set_bbox_to_anchor' using matplotlib 0.98.5.3 on linux/gentoo am I missing something? or is my version of matplotlib not appropriate? Jae-Joon Lee wrote: The linked page below shows how you put the legend above the graph. http://matplotlib.sourceforge.net/users/plotting/legend.html#legend-location You can put it below the axes by adjusting the bbox_to_anchor parameter. Try something like bbox_to_anchor=(0., -0.1, 1., -0.1), loc=1 Make sure to adjust the suplot parameter (or axes location) to make enough room for the legend. -JJ On Thu, Jun 25, 2009 at 9:22 PM, Chris Spencerchriss...@gmail.com wrote: How do you show the legend below the graph, so it doesn't overlap at all with the graph? The docs for the legend() loc parameter only seem to specify where *on* the graph you want it to show, which is driving me nuts because even using best, it usually hides some of my data. I want to see *all* of my graph, as well as the legend. Is there any way to do this with pylab? Any help is appreciated. Chris -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users This message contains confidential information and may contain information that is legally privileged. If you have received this message by mistake, please immediately notify us and delete the original message. Thank you. Ce message contient des informations confidentielles. S'il vous est parvenu par erreur, merci de bien vouloir nous en aviser par retour, de n'en faire aucun usage et de n'en garder aucune copie. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Stopping Legend From Overlapping the Graph
How do you show the legend below the graph, so it doesn't overlap at all with the graph? The docs for the legend() loc parameter only seem to specify where *on* the graph you want it to show, which is driving me nuts because even using best, it usually hides some of my data. I want to see *all* of my graph, as well as the legend. Is there any way to do this with pylab? Any help is appreciated. Chris -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Stopping Legend From Overlapping the Graph
The linked page below shows how you put the legend above the graph. http://matplotlib.sourceforge.net/users/plotting/legend.html#legend-location You can put it below the axes by adjusting the bbox_to_anchor parameter. Try something like bbox_to_anchor=(0., -0.1, 1., -0.1), loc=1 Make sure to adjust the suplot parameter (or axes location) to make enough room for the legend. -JJ On Thu, Jun 25, 2009 at 9:22 PM, Chris Spencerchriss...@gmail.com wrote: How do you show the legend below the graph, so it doesn't overlap at all with the graph? The docs for the legend() loc parameter only seem to specify where *on* the graph you want it to show, which is driving me nuts because even using best, it usually hides some of my data. I want to see *all* of my graph, as well as the legend. Is there any way to do this with pylab? Any help is appreciated. Chris -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users