|
From: magurling <mag...@gm...> - 2011-11-09 00:49:40
|
I want a legend without the black border. I've tried a few things that have
been suggested on this forum and elsewhere to no avail. According to what
I've seen, it should be as simple as:
import matplotlib.pyplot as plt
import numpy as np
N = 5
Means1 = (20, 35, 30, 35, 27)
Means2 = (25, 32, 34, 20, 25)
ind = np.arange(N) # the x locations for the groups
width = 0.20 # the width of the bars
fig = plt.figure()
ax = fig.add_subplot(111)
rects1 = ax.bar(ind, Means1, width, color='k')
rects2 = ax.bar(ind+width, Means2, width, color='w')
ax.legend( (rects1[0], rects2[0]), ('set1', 'set2'), frameon=False )
plt.show()
It all works except for "frameon=False"
I get this:
/usr/lib/pymodules/python2.7/matplotlib/axes.pyc in legend(self, *args,
**kwargs)
4042
4043 handles = cbook.flatten(handles)
-> 4044 self.legend_ = mlegend.Legend(self, handles, labels,
**kwargs)
4045 return self.legend_
4046
TypeError: __init__() got an unexpected keyword argument 'frameon'
I've also checked my matplotlibrc under the "Legend" section and I don't see
a "legend.frameon" line.
It must be something simple that I am doing wrong. Any ideas?
--
View this message in context: http://old.nabble.com/legend-border%2C-frameon-keyword-tp32807933p32807933.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
|
|
From: Francesco M. <fra...@go...> - 2011-11-11 16:42:01
|
Hi,
I usually do like this
l = ax.legend( (rects1[0], rects2[0]), ('set1', 'set2'))
l.draw_frame(False)
Cheers,
Francesco
2011/11/9 magurling <mag...@gm...>:
>
> I want a legend without the black border. I've tried a few things that have
> been suggested on this forum and elsewhere to no avail. According to what
> I've seen, it should be as simple as:
>
> import matplotlib.pyplot as plt
> import numpy as np
>
> N = 5
> Means1 = (20, 35, 30, 35, 27)
> Means2 = (25, 32, 34, 20, 25)
>
> ind = np.arange(N) # the x locations for the groups
> width = 0.20 # the width of the bars
>
> fig = plt.figure()
> ax = fig.add_subplot(111)
> rects1 = ax.bar(ind, Means1, width, color='k')
> rects2 = ax.bar(ind+width, Means2, width, color='w')
>
> ax.legend( (rects1[0], rects2[0]), ('set1', 'set2'), frameon=False )
>
> plt.show()
>
>
> It all works except for "frameon=False"
>
> I get this:
>
> /usr/lib/pymodules/python2.7/matplotlib/axes.pyc in legend(self, *args,
> **kwargs)
> 4042
> 4043 handles = cbook.flatten(handles)
> -> 4044 self.legend_ = mlegend.Legend(self, handles, labels,
> **kwargs)
> 4045 return self.legend_
> 4046
>
> TypeError: __init__() got an unexpected keyword argument 'frameon'
>
> I've also checked my matplotlibrc under the "Legend" section and I don't see
> a "legend.frameon" line.
>
> It must be something simple that I am doing wrong. Any ideas?
> --
> View this message in context: http://old.nabble.com/legend-border%2C-frameon-keyword-tp32807933p32807933.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> RSA(R) Conference 2012
> Save $700 by Nov 18
> Register now
> http://p.sf.net/sfu/rsa-sfdev2dev1
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
|
|
From: magurling <mag...@gm...> - 2011-11-11 19:15:13
|
Thanks Francesco, but I've also tried to use the "draw_frame(False)" method
with no luck.
montefra wrote:
>
> Hi,
>
> I usually do like this
>
> l = ax.legend( (rects1[0], rects2[0]), ('set1', 'set2'))
> l.draw_frame(False)
>
> Cheers,
>
> Francesco
>
> 2011/11/9 magurling <mag...@gm...>:
>>
>> I want a legend without the black border. I've tried a few things that
>> have
>> been suggested on this forum and elsewhere to no avail. According to what
>> I've seen, it should be as simple as:
>>
>> import matplotlib.pyplot as plt
>> import numpy as np
>>
>> N = 5
>> Means1 = (20, 35, 30, 35, 27)
>> Means2 = (25, 32, 34, 20, 25)
>>
>> ind = np.arange(N) # the x locations for the groups
>> width = 0.20 # the width of the bars
>>
>> fig = plt.figure()
>> ax = fig.add_subplot(111)
>> rects1 = ax.bar(ind, Means1, width, color='k')
>> rects2 = ax.bar(ind+width, Means2, width, color='w')
>>
>> ax.legend( (rects1[0], rects2[0]), ('set1', 'set2'), frameon=False )
>>
>> plt.show()
>>
>>
>> It all works except for "frameon=False"
>>
>> I get this:
>>
>> /usr/lib/pymodules/python2.7/matplotlib/axes.pyc in legend(self, *args,
>> **kwargs)
>> 4042
>> 4043 handles = cbook.flatten(handles)
>> -> 4044 self.legend_ = mlegend.Legend(self, handles, labels,
>> **kwargs)
>> 4045 return self.legend_
>> 4046
>>
>> TypeError: __init__() got an unexpected keyword argument 'frameon'
>>
>> I've also checked my matplotlibrc under the "Legend" section and I don't
>> see
>> a "legend.frameon" line.
>>
>> It must be something simple that I am doing wrong. Any ideas?
>> --
>> View this message in context:
>> http://old.nabble.com/legend-border%2C-frameon-keyword-tp32807933p32807933.html
>> Sent from the matplotlib - users mailing list archive at Nabble.com.
>>
>>
>> ------------------------------------------------------------------------------
>> RSA(R) Conference 2012
>> Save $700 by Nov 18
>> Register now
>> http://p.sf.net/sfu/rsa-sfdev2dev1
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
> ------------------------------------------------------------------------------
> RSA(R) Conference 2012
> Save $700 by Nov 18
> Register now
> http://p.sf.net/sfu/rsa-sfdev2dev1
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
View this message in context: http://old.nabble.com/legend-border%2C-frameon-keyword-tp32807933p32827812.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
|
|
From: Paul I. <piv...@gm...> - 2011-11-11 17:05:40
|
Oops, didn't reply to list last time: On Fri, Nov 11, 2011 at 8:53 AM, Paul Ivanov <piv...@gm...> wrote: > On Tue, Nov 8, 2011 at 4:49 PM, magurling <mag...@gm...> wrote: >> >> I want a legend without the black border. I've tried a few things that have >> been suggested on this forum and elsewhere to no avail. According to what >> I've seen, it should be as simple as: > > Your example works as intended here. > > >> It must be something simple that I am doing wrong. Any ideas? > > might you be on an old matplotlib.__version__? best, -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 |
|
From: magurling <mag...@gm...> - 2011-11-11 19:18:11
|
This is probably it. I installed by "apt-get install" but keep getting version 0.99.3 installed. I need to install a more recent version before I trouble anyone further. Which version are you using Paul? Paul Ivanov wrote: > > Oops, didn't reply to list last time: > > On Fri, Nov 11, 2011 at 8:53 AM, Paul Ivanov <piv...@gm...> wrote: >> On Tue, Nov 8, 2011 at 4:49 PM, magurling <mag...@gm...> wrote: >>> >>> I want a legend without the black border. I've tried a few things that >>> have >>> been suggested on this forum and elsewhere to no avail. According to >>> what >>> I've seen, it should be as simple as: >> >> Your example works as intended here. >> >> >>> It must be something simple that I am doing wrong. Any ideas? >> >> might you be on an old matplotlib.__version__? > > > best, > -- > Paul Ivanov > 314 address only used for lists, off-list direct email at: > http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 > > ------------------------------------------------------------------------------ > RSA(R) Conference 2012 > Save $700 by Nov 18 > Register now > http://p.sf.net/sfu/rsa-sfdev2dev1 > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://old.nabble.com/legend-border%2C-frameon-keyword-tp32807933p32827837.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Paul I. <piv...@gm...> - 2011-11-11 19:44:44
|
>> On Fri, Nov 11, 2011 at 8:53 AM, Paul Ivanov <piv...@gm...> wrote: >>> might you be on an old matplotlib.__version__? On Fri, Nov 11, 2011 at 11:18 AM, magurling <mag...@gm...> wrote: > This is probably it. I installed by "apt-get install" but keep getting > version 0.99.3 installed. > I need to install a more recent version before I trouble anyone further. > Which version are you using Paul? 1.2.0dev from Git :), but you will be fine with the latest stable (v1.1.0) see http://matplotlib.sourceforge.net/users/installing.html#installing-from-source best, -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 |
|
From: magurling <mag...@gm...> - 2011-11-11 20:40:33
|
I updated matplotlib to 1.1.0; both methods work now. I would say "Thanks Paul and Francesco" but I just read the mailing list etiquette. -- View this message in context: http://old.nabble.com/legend-border%2C-frameon-keyword-tp32807933p32828355.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Paul I. <piv...@gm...> - 2011-11-12 01:03:35
|
On Fri, Nov 11, 2011 at 12:40 PM, magurling <mag...@gm...> wrote: > I updated matplotlib to 1.1.0; both methods work now. Thanks for letting us know, and glad it works for you now - that information is useful for those who search for similar error messages in the future and find this thread. > I would say "Thanks Paul and Francesco" but I just read the mailing list etiquette. you're very welcome - though I'm not sure what etiquette you're referring to? I think it's useful for poster who ask for help to report back when they've overcome whatever problem they were having along with how they resolved it, so that others can follow in their footsteps later. best, -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 |