Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9bf8d02

Browse files
author
Marek Rudnicki
committed
legend.facecolor and edgecolor default to None
1 parent d58a84a commit 9bf8d02

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

lib/matplotlib/legend.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,10 +346,21 @@ def __init__(self, parent, handles, labels,
346346
# We use FancyBboxPatch to draw a legend frame. The location
347347
# and size of the box will be updated during the drawing time.
348348

349+
if rcParams["legend.facecolor"] is None:
350+
facecolor = rcParams["axes.facecolor"]
351+
else:
352+
facecolor = rcParams["legend.facecolor"]
353+
354+
if rcParams["legend.edgecolor"] is None:
355+
edgecolor = rcParams["axes.edgecolor"]
356+
else:
357+
edgecolor = rcParams["legend.edgecolor"]
358+
359+
349360
self.legendPatch = FancyBboxPatch(
350361
xy=(0.0, 0.0), width=1., height=1.,
351-
facecolor=rcParams["legend.facecolor"],
352-
edgecolor=rcParams["legend.edgecolor"],
362+
facecolor=facecolor,
363+
edgecolor=edgecolor,
353364
mutation_scale=self._fontsize,
354365
snap=True
355366
)

0 commit comments

Comments
 (0)