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 <magurl...@gmail.com>:
>
> 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
> Matplotlib-users@lists.sourceforge.net
> 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to