I noticed that this didn't exist and I never seem to want a frame anyway so here's a patch. I wasn't sure if anything in doc/ needed to be changed...

I don't really like the name "legend.frameon". I'd rather have "legend.frame" or "legend.useframe". If people would accept changing the name of the keyword, then this patch probably shouldn't be committed.

M
diff --git a/lib/matplotlib/axes.py b/lib/matplotlib/axes.py
index f47eaa4..a14421f 100644
--- a/lib/matplotlib/axes.py
+++ b/lib/matplotlib/axes.py
@@ -4318,7 +4318,7 @@ class Axes(martist.Artist):
             settings.
 
           *frameon*: [ True | False ]
-            if True, draw a frame.  Default is True
+            if True, draw a frame around the legend.
 
           *fancybox*: [ None | False | True ]
             if True, draw a frame with a round fancybox.  If None, use rc
diff --git a/lib/matplotlib/legend.py b/lib/matplotlib/legend.py
index 9a838fd..33425b4 100644
--- a/lib/matplotlib/legend.py
+++ b/lib/matplotlib/legend.py
@@ -166,7 +166,7 @@ class Legend(Artist):
                  title = None, # set a title for the legend
                  bbox_to_anchor = None, # bbox that the legend will be 
anchored.
                  bbox_transform = None, # transform for the bbox
-                 frameon = True, # draw frame
+                 frameon = None, # draw frame
                  ):
         """
         - *parent* : the artist that contains the legend
@@ -184,7 +184,7 @@ class Legend(Artist):
         numpoints          the number of points in the legend for line
         scatterpoints      the number of points in the legend for scatter plot
         scatteryoffsets    a list of yoffsets for scatter symbols in legend
-        frameon            if True, draw a frame (default is True)
+        frameon            if True, draw a frame around the legend
         fancybox           if True, draw a frame with a round fancybox.  If 
None, use rc
         shadow             if True, draw a shadow behind legend
         ncol               number of columns
@@ -359,7 +359,8 @@ in the normalized axes coordinate.
 
         self._set_artist_props(self.legendPatch)
 
-        self._drawFrame = frameon
+        if frameon is None:
+            self._drawFrame = rcParams["legend.frameon"]
 
         # init with null renderer
         self._init_legend_box(handles, labels)
diff --git a/lib/matplotlib/rcsetup.py b/lib/matplotlib/rcsetup.py
index f3198d8..91579a3 100644
--- a/lib/matplotlib/rcsetup.py
+++ b/lib/matplotlib/rcsetup.py
@@ -458,6 +458,7 @@ defaultParams = {
     'legend.fontsize'    : ['large', validate_fontsize],
     'legend.markerscale' : [1.0, validate_float], # the relative size of 
legend markers vs. original
     'legend.shadow'        : [False, validate_bool],
+    'legend.frameon'     : [True, validate_bool], # whether or not to draw a 
frame around legend
 
 
     # the following dimensions are in fraction of the font size
diff --git a/matplotlibrc.template b/matplotlibrc.template
index 67933f9..7a888b9 100644
--- a/matplotlibrc.template
+++ b/matplotlibrc.template
@@ -249,6 +249,7 @@ backend      : %(backend)s
 #legend.handletextsep : 0.02   # the space between the legend line and legend 
text
 #legend.axespad       : 0.02   # the border between the axes and legend edge
 #legend.shadow        : False
+#legend.frameon       : True   # whether or not to draw a frame around legend
 
 ### FIGURE
 # See 
http://matplotlib.sourceforge.net/api/figure_api.html#matplotlib.figure.Figure
------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to