Skip to content

Commit c90469b

Browse files
committed
Revert "Merge pull request matplotlib#3792 from mrkrd/master"
This reverts commit 92e608d, reversing changes made to 8c4626f.
1 parent e783caa commit c90469b

File tree

6 files changed

+16
-68
lines changed

6 files changed

+16
-68
lines changed

doc/users/whats_new/rcparams.rst

+1-5
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,9 @@ Added "figure.titlesize" and "figure.titleweight" keys to rcParams
99
Two new keys were added to rcParams to control the default font size and weight
1010
used by the figure title (as emitted by ``pyplot.suptitle()``).
1111

12-
Added "legend.facecolor" and "legend.edgecolor" keys to rcParams
13-
````````````````````````````````````````````````````````````````
14-
The new keys control colors (background and edge) of legend patches.
15-
1612
``image.composite_image`` added to rcParams
1713
```````````````````````````````````````````
1814
Controls whether vector graphics backends (i.e. PDF, PS, and SVG) combine
1915
multiple images on a set of axes into a single composite image. Saving each
20-
image individually can be useful if you generate vector graphics files in
16+
image individually can be useful if you generate vector graphics files in
2117
matplotlib and then edit the files further in Inkscape or other programs.

lib/matplotlib/legend.py

+2-12
Original file line numberDiff line numberDiff line change
@@ -345,20 +345,10 @@ def __init__(self, parent, handles, labels,
345345
# We use FancyBboxPatch to draw a legend frame. The location
346346
# and size of the box will be updated during the drawing time.
347347

348-
if rcParams["legend.facecolor"] is None:
349-
facecolor = rcParams["axes.facecolor"]
350-
else:
351-
facecolor = rcParams["legend.facecolor"]
352-
353-
if rcParams["legend.edgecolor"] is None:
354-
edgecolor = rcParams["axes.edgecolor"]
355-
else:
356-
edgecolor = rcParams["legend.edgecolor"]
357-
358348
self.legendPatch = FancyBboxPatch(
359349
xy=(0.0, 0.0), width=1., height=1.,
360-
facecolor=facecolor,
361-
edgecolor=edgecolor,
350+
facecolor=rcParams["axes.facecolor"],
351+
edgecolor=rcParams["axes.edgecolor"],
362352
mutation_scale=self._fontsize,
363353
snap=True
364354
)

lib/matplotlib/mpl-data/stylelib/ggplot.mplstyle

+1-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ axes.color_cycle: E24A33, 348ABD, 988ED5, 777777, FBC15E, 8EBA42, FFB5B8
2525
# 8EBA42 : green
2626
# FFB5B8 : pink
2727

28-
legend.facecolor: white
29-
legend.edgecolor: white
30-
3128
xtick.color: 555555
3229
xtick.direction: out
3330

@@ -39,3 +36,4 @@ grid.linestyle: - # solid line
3936

4037
figure.facecolor: white
4138
figure.edgecolor: 0.50
39+

lib/matplotlib/rcsetup.py

+5-8
Original file line numberDiff line numberDiff line change
@@ -237,16 +237,16 @@ def __call__(self, s):
237237

238238
def validate_color(s):
239239
'return a valid color arg'
240-
if s in (None, 'none', 'None'):
241-
return None
242-
240+
try:
241+
if s.lower() == 'none':
242+
return 'None'
243+
except AttributeError:
244+
pass
243245
if is_color_like(s):
244246
return s
245-
246247
stmp = '#' + s
247248
if is_color_like(stmp):
248249
return stmp
249-
250250
# If it is still valid, it must be a tuple.
251251
colorarg = s
252252
msg = ''
@@ -685,9 +685,6 @@ def __call__(self, s):
685685
# the relative size of legend markers vs. original
686686
'legend.markerscale': [1.0, validate_float],
687687
'legend.shadow': [False, validate_bool],
688-
'legend.facecolor': [None, validate_color], # background color; white
689-
'legend.edgecolor': [None, validate_color], # edge color; black
690-
691688

692689
## tick properties
693690
'xtick.major.size': [4, validate_float], # major xtick size in points

lib/matplotlib/tests/test_legend.py

-29
Original file line numberDiff line numberDiff line change
@@ -240,35 +240,6 @@ def test_legend_stackplot():
240240
ax.legend(loc=0)
241241

242242

243-
@cleanup
244-
def _test_rcparams_helper(test_rcparams, facecolor_target, edgecolor_target):
245-
with mpl.rc_context(test_rcparams):
246-
fig, ax = plt.subplots(1, 1)
247-
t = np.linspace(0, 2*np.pi)
248-
ax.plot(t, np.sin(t), label='sin')
249-
ax.plot(t, np.cos(t), label='cos')
250-
leg = ax.legend()
251-
252-
assert_equal(mpl.colors.colorConverter.to_rgba(facecolor_target),
253-
leg.legendPatch.get_facecolor())
254-
255-
assert_equal(mpl.colors.colorConverter.to_rgba(edgecolor_target),
256-
leg.legendPatch.get_edgecolor())
257-
258-
259-
def test_rcparams_():
260-
test_vals = [({}, mpl.rcParams['axes.facecolor'],
261-
mpl.rcParams['axes.edgecolor']),
262-
({'axes.facecolor': 'r', 'axes.edgecolor': 'c'}, 'r', 'c'),
263-
({'axes.facecolor': 'r', 'axes.edgecolor': 'c',
264-
'legend.facecolor': 'w', 'legend.edgecolor': 'k'},
265-
'w', 'k'),
266-
]
267-
268-
for rc_dict, face, edge in test_vals:
269-
yield _test_rcparams_helper, rc_dict, face, edge
270-
271-
272243
if __name__ == '__main__':
273244
import nose
274245
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)

matplotlibrc.template

+7-11
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,10 @@ backend : %(backend)s
256256
# separator in the fr_FR locale.
257257
#axes.formatter.use_mathtext : False # When True, use mathtext for scientific
258258
# notation.
259-
#axes.formatter.useoffset : True # If True, the tick label formatter
260-
# will default to labeling ticks relative
261-
# to an offset when the data range is very
262-
# small compared to the minimum absolute
259+
#axes.formatter.useoffset : True # If True, the tick label formatter
260+
# will default to labeling ticks relative
261+
# to an offset when the data range is very
262+
# small compared to the minimum absolute
263263
# value of the data.
264264

265265
#axes.unicode_minus : True # use unicode for the minus symbol
@@ -307,7 +307,7 @@ backend : %(backend)s
307307
### Legend
308308
#legend.fancybox : False # if True, use a rounded box for the
309309
# legend, else a rectangle
310-
#legend.isaxes : True # this option is internally ignored
310+
#legend.isaxes : True
311311
#legend.numpoints : 2 # the number of points in the legend line
312312
#legend.fontsize : large
313313
#legend.borderpad : 0.5 # border whitespace in fontsize units
@@ -323,10 +323,6 @@ backend : %(backend)s
323323
#legend.frameon : True # whether or not to draw a frame around legend
324324
#legend.framealpha : None # opacity of of legend frame
325325
#legend.scatterpoints : 3 # number of scatter points
326-
#legend.facecolor : None # legend background color (when None inherits from axes.facecolor)
327-
#legend.edgecolor : None # legend edge color (when None inherits from axes.facecolor)
328-
329-
330326

331327
### FIGURE
332328
# See http://matplotlib.org/api/figure_api.html#matplotlib.figure.Figure
@@ -411,7 +407,7 @@ backend : %(backend)s
411407
#savefig.jpeg_quality: 95 # when a jpeg is saved, the default quality parameter.
412408
#savefig.directory : ~ # default directory in savefig dialog box,
413409
# leave empty to always use current working directory
414-
#savefig.transparent : False # setting that controls whether figures are saved with a
410+
#savefig.transparent : False # setting that controls whether figures are saved with a
415411
# transparent background by default
416412

417413
# tk backend params
@@ -501,5 +497,5 @@ backend : %(backend)s
501497
# $PATH is searched
502498
#animation.mencoder_args: '' # Additional arguments to pass to mencoder
503499
#animation.convert_path: 'convert' # Path to ImageMagick's convert binary.
504-
# On Windows use the full path since convert
500+
# On Windows use the full path since convert
505501
# is also the name of a system tool.

0 commit comments

Comments
 (0)