Hello,

after looking at the code I found that there are two settings that are
not documented (they are not in the template matplotlibrc) that control
the legend frame: "legend.edgecolor" and "legend.facecolor".

The first is enough for my needs, however I think it would be nice to
add the possibility to control the frame linewidth. I have a small patch
that add a "legend.linewidth" setting that defaults to "inherit",
meaning that the legend frame has the same width of the axes. The
setting name is not the most intuitive, but it is coherent with the
existing "legend.edgecolor" and "legend.facecolor".

It would be better to replace "legend.frmaeon" with a boolean setting
"legend.frame and control the frame with "legend.frame.edgecolor",
"legend.frame.facecolor" and "legend.frame.linewidth". But this would
require deprecating the old settings. I can prepare a patch if this is
desired.

Cheers,
Daniele


On 13/11/15 17:08, Benjamin Root wrote:
> Indeed, it looks like there isn't a very good way to control all of the
> properties of the frame portion of a legend. This could certainly use
> some improvements, partly in allowing a dictionary of property values to
> be passed in `plt.legend()` (there is already a dictionary of font
> properties), but also to have some rcParams that could be made
> available, too. Such improvements are always welcome!
> 
> Cheers!
> Ben Root
> 
> On Fri, Nov 13, 2015 at 7:57 AM, Daniele Nicolodi <dani...@grinta.net
> <mailto:dani...@grinta.net>> wrote:
> 
>     Hello,
> 
>     there is a way to control the edgecolor and the linewidth of the frame
>     drawn around the legend?  I set the axes linewidth to 0.5 but the legend
>     frame linewidth is set to 1.0 and it does not look nice. Also, most of
>     the time I don't want the frame edge to be drawn at all.
> 
>     Always doing:
> 
>       l = plt.legend()
>       l.get_frame().set_edgecolor('none')
> 
>     is boring.
> 
>     If the setting are not there, would a patch adding a setting to style
>     the legend frame be considered? Additionally, would it make sense to
>     default the legend frame linewidth to the axes linewidth?
> 
>     Cheers,
>     Daniele
> 
>     
> ------------------------------------------------------------------------------
>     _______________________________________________
>     Matplotlib-users mailing list
>     Matplotlib-users@lists.sourceforge.net
>     <mailto: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

Reply via email to