Skip to content

Commit 0fc6fbe

Browse files
committed
remove unnecessary loc=1 in new tests for labelcolor_linecolor
1 parent 8d9555e commit 0fc6fbe

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

lib/matplotlib/tests/test_legend.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,7 +1075,7 @@ def test_legend_labelcolor_linecolor_histograms():
10751075
fig, ax = plt.subplots()
10761076
_, _, h = ax.hist(x, histtype='bar', color='r',
10771077
label="red bar hist with a red label")
1078-
leg = ax.legend(loc=1, labelcolor='linecolor')
1078+
leg = ax.legend(labelcolor='linecolor')
10791079
tc = leg.texts[0].get_color()
10801080
assert mpl.colors.same_color(tc, 'r')
10811081
assert mpl.colors.same_color(tc, leg.get_patches()[0].get_facecolor())
@@ -1084,7 +1084,7 @@ def test_legend_labelcolor_linecolor_histograms():
10841084
fig, ax = plt.subplots()
10851085
_, _, h = ax.hist(x, histtype='step', color='g',
10861086
label="green step hist with a green label")
1087-
leg = ax.legend(loc=1, labelcolor='linecolor')
1087+
leg = ax.legend(labelcolor='linecolor')
10881088
tc = leg.texts[0].get_color()
10891089
assert mpl.colors.same_color(tc, 'g')
10901090
assert mpl.colors.same_color(tc, leg.get_patches()[0].get_edgecolor())
@@ -1093,7 +1093,7 @@ def test_legend_labelcolor_linecolor_histograms():
10931093
fig, ax = plt.subplots()
10941094
_, _, h = ax.hist(x, histtype='stepfilled', color='b',
10951095
label="blue stepfilled hist with a blue label")
1096-
leg = ax.legend(loc=1, labelcolor='linecolor')
1096+
leg = ax.legend(labelcolor='linecolor')
10971097
tc = leg.texts[0].get_color()
10981098
assert mpl.colors.same_color(tc, 'b')
10991099
assert mpl.colors.same_color(tc, leg.get_patches()[0].get_facecolor())
@@ -1103,7 +1103,7 @@ def test_legend_labelcolor_linecolor_histograms():
11031103
fig, ax = plt.subplots()
11041104
_, _, h = ax.hist(x, histtype='bar', color='r', ec='b',
11051105
label="red bar hist with blue edges and a red label")
1106-
leg = ax.legend(loc=1, labelcolor='linecolor')
1106+
leg = ax.legend(labelcolor='linecolor')
11071107
tc = leg.texts[0].get_color()
11081108
assert mpl.colors.same_color(tc, 'r')
11091109
assert mpl.colors.same_color(tc, leg.get_patches()[0].get_facecolor())
@@ -1112,7 +1112,7 @@ def test_legend_labelcolor_linecolor_histograms():
11121112
fig, ax = plt.subplots()
11131113
_, _, h = ax.hist(x, histtype='bar', fc='r', ec='b',
11141114
label="red bar hist with blue edges and a red label")
1115-
leg = ax.legend(loc=1, labelcolor='linecolor')
1115+
leg = ax.legend(labelcolor='linecolor')
11161116
tc = leg.texts[0].get_color()
11171117
assert mpl.colors.same_color(tc, 'r')
11181118
assert mpl.colors.same_color(tc, leg.get_patches()[0].get_facecolor())
@@ -1121,7 +1121,7 @@ def test_legend_labelcolor_linecolor_histograms():
11211121
fig, ax = plt.subplots()
11221122
_, _, h = ax.hist(x, histtype='bar', fc='none', ec='b',
11231123
label="unfilled blue bar hist with a blue label")
1124-
leg = ax.legend(loc=1, labelcolor='linecolor')
1124+
leg = ax.legend(labelcolor='linecolor')
11251125
tc = leg.texts[0].get_color()
11261126
assert mpl.colors.same_color(tc, 'b')
11271127
assert mpl.colors.same_color(tc, leg.get_patches()[0].get_edgecolor())
@@ -1131,7 +1131,7 @@ def test_legend_labelcolor_linecolor_histograms():
11311131
fig, ax = plt.subplots()
11321132
_, _, h = ax.hist(x, histtype='step', color='r', ec='b',
11331133
label="blue step hist with a blue label")
1134-
leg = ax.legend(loc=1, labelcolor='linecolor')
1134+
leg = ax.legend(labelcolor='linecolor')
11351135
tc = leg.texts[0].get_color()
11361136
assert mpl.colors.same_color(tc, 'b')
11371137
assert mpl.colors.same_color(tc, leg.get_patches()[0].get_edgecolor())
@@ -1140,7 +1140,7 @@ def test_legend_labelcolor_linecolor_histograms():
11401140
fig, ax = plt.subplots()
11411141
_, _, h = ax.hist(x, histtype='step', ec='b',
11421142
label="blue step hist with a blue label")
1143-
leg = ax.legend(loc=1, labelcolor='linecolor')
1143+
leg = ax.legend(labelcolor='linecolor')
11441144
tc = leg.texts[0].get_color()
11451145
assert mpl.colors.same_color(tc, 'b')
11461146
assert mpl.colors.same_color(tc, leg.get_patches()[0].get_edgecolor())
@@ -1150,7 +1150,7 @@ def test_legend_labelcolor_linecolor_histograms():
11501150
fig, ax = plt.subplots()
11511151
_, _, h = ax.hist(x, histtype='stepfilled', color='r', ec='b',
11521152
label="red stepfilled hist, blue edges, red label")
1153-
leg = ax.legend(loc=1, labelcolor='linecolor')
1153+
leg = ax.legend(labelcolor='linecolor')
11541154
tc = leg.texts[0].get_color()
11551155
assert mpl.colors.same_color(tc, 'r')
11561156
assert mpl.colors.same_color(tc, leg.get_patches()[0].get_facecolor())
@@ -1159,7 +1159,7 @@ def test_legend_labelcolor_linecolor_histograms():
11591159
fig, ax = plt.subplots()
11601160
_, _, h = ax.hist(x, histtype='stepfilled', fc='r', ec='b',
11611161
label="red stepfilled hist, blue edges, red label")
1162-
leg = ax.legend(loc=1, labelcolor='linecolor')
1162+
leg = ax.legend(labelcolor='linecolor')
11631163
tc = leg.texts[0].get_color()
11641164
assert mpl.colors.same_color(tc, 'r')
11651165
assert mpl.colors.same_color(tc, leg.get_patches()[0].get_facecolor())
@@ -1168,7 +1168,7 @@ def test_legend_labelcolor_linecolor_histograms():
11681168
fig, ax = plt.subplots()
11691169
_, _, h = ax.hist(x, histtype='stepfilled', fc='none', ec='b',
11701170
label="unfilled blue stepfilled hist, blue label")
1171-
leg = ax.legend(loc=1, labelcolor='linecolor')
1171+
leg = ax.legend(labelcolor='linecolor')
11721172
tc = leg.texts[0].get_color()
11731173
assert mpl.colors.same_color(tc, 'b')
11741174
assert mpl.colors.same_color(tc, leg.get_patches()[0].get_edgecolor())
@@ -1177,7 +1177,7 @@ def test_legend_labelcolor_linecolor_histograms():
11771177
fig, ax = plt.subplots()
11781178
_, _, h = ax.hist(x, histtype='stepfilled', fc='r', ec='none',
11791179
label="edgeless red stepfilled hist with a red label")
1180-
leg = ax.legend(loc=1, labelcolor='linecolor')
1180+
leg = ax.legend(labelcolor='linecolor')
11811181
tc = leg.texts[0].get_color()
11821182
assert mpl.colors.same_color(tc, 'r')
11831183
assert mpl.colors.same_color(tc, leg.get_patches()[0].get_facecolor())
@@ -1191,7 +1191,7 @@ def test_legend_labelcolor_linecolor_plot():
11911191
# testing line plot
11921192
fig, ax = plt.subplots()
11931193
p = ax.plot(x, c='r', label="red line with a red label")
1194-
leg = ax.legend(loc=1, labelcolor='linecolor')
1194+
leg = ax.legend(labelcolor='linecolor')
11951195
tc = leg.texts[0].get_color()
11961196
assert mpl.colors.same_color(tc, 'r')
11971197
assert mpl.colors.same_color(tc, leg.get_lines()[0].get_color())
@@ -1200,23 +1200,23 @@ def test_legend_labelcolor_linecolor_plot():
12001200
# testing c, fc, and ec combinations for maker plots
12011201
fig, ax = plt.subplots()
12021202
p = ax.plot(x, 'o', c='r', label="red circles with a red label")
1203-
leg = ax.legend(loc=1, labelcolor='linecolor')
1203+
leg = ax.legend(labelcolor='linecolor')
12041204
tc = leg.texts[0].get_color()
12051205
assert mpl.colors.same_color(tc, 'r')
12061206
assert mpl.colors.same_color(tc, leg.get_lines()[0].get_color())
12071207
assert mpl.colors.same_color(tc, p[0].get_color())
12081208

12091209
fig, ax = plt.subplots()
12101210
p = ax.plot(x, 'o', c='r', mec='b', label="red circles, blue edges, red label")
1211-
leg = ax.legend(loc=1, labelcolor='linecolor')
1211+
leg = ax.legend(labelcolor='linecolor')
12121212
tc = leg.texts[0].get_color()
12131213
assert mpl.colors.same_color(tc, 'r')
12141214
assert mpl.colors.same_color(tc, leg.get_lines()[0].get_color())
12151215
assert mpl.colors.same_color(tc, p[0].get_color())
12161216

12171217
fig, ax = plt.subplots()
12181218
p = ax.plot(x, 'o', mfc='r', mec='b', label="red circles, blue edges, red label")
1219-
leg = ax.legend(loc=1, labelcolor='linecolor')
1219+
leg = ax.legend(labelcolor='linecolor')
12201220
tc = leg.texts[0].get_color()
12211221
assert mpl.colors.same_color(tc, 'r')
12221222
assert mpl.colors.same_color(tc, leg.get_lines()[0].get_markerfacecolor())
@@ -1225,23 +1225,23 @@ def test_legend_labelcolor_linecolor_plot():
12251225
# 'none' cases
12261226
fig, ax = plt.subplots()
12271227
p = ax.plot(x, 'o', mfc='none', mec='b', label="blue unfilled circles, blue label")
1228-
leg = ax.legend(loc=1, labelcolor='linecolor')
1228+
leg = ax.legend(labelcolor='linecolor')
12291229
tc = leg.texts[0].get_color()
12301230
assert mpl.colors.same_color(tc, 'b')
12311231
assert mpl.colors.same_color(tc, leg.get_lines()[0].get_markeredgecolor())
12321232
assert mpl.colors.same_color(tc, p[0].get_markeredgecolor())
12331233

12341234
fig, ax = plt.subplots()
12351235
p = ax.plot(x, 'o', mfc='r', mec='none', label="red edgeless circles, red label")
1236-
leg = ax.legend(loc=1, labelcolor='linecolor')
1236+
leg = ax.legend(labelcolor='linecolor')
12371237
tc = leg.texts[0].get_color()
12381238
assert mpl.colors.same_color(tc, 'r')
12391239
assert mpl.colors.same_color(tc, leg.get_lines()[0].get_markerfacecolor())
12401240
assert mpl.colors.same_color(tc, p[0].get_markerfacecolor())
12411241

12421242
fig, ax = plt.subplots()
12431243
p = ax.plot(x, 'o', c='none', mec='none', label="invisible circles and label")
1244-
leg = ax.legend(loc=1, labelcolor='linecolor')
1244+
leg = ax.legend(labelcolor='linecolor')
12451245
tc = leg.texts[0].get_color()
12461246
assert tc == 'none'
12471247
assert tc == leg.get_lines()[0].get_markerfacecolor()
@@ -1259,23 +1259,23 @@ def test_legend_labelcolor_linecolor_scatter():
12591259
# testing c, fc, and ec combinations for scatter plots
12601260
fig, ax = plt.subplots()
12611261
p = ax.scatter(x, x, c='r', label="red circles with a red label")
1262-
leg = ax.legend(loc=1, labelcolor='linecolor')
1262+
leg = ax.legend(labelcolor='linecolor')
12631263
tc = leg.texts[0].get_color()
12641264
assert mpl.colors.same_color(tc, 'r')
12651265
assert mpl.colors.same_color(tc, leg.legend_handles[0].get_facecolor())
12661266
assert mpl.colors.same_color(tc, p.get_facecolor())
12671267

12681268
fig, ax = plt.subplots()
12691269
p = ax.scatter(x, x, c='r', ec='b', label="red circles, blue edges, red label")
1270-
leg = ax.legend(loc=1, labelcolor='linecolor')
1270+
leg = ax.legend(labelcolor='linecolor')
12711271
tc = leg.texts[0].get_color()
12721272
assert mpl.colors.same_color(tc, 'r')
12731273
assert mpl.colors.same_color(tc, leg.legend_handles[0].get_facecolor())
12741274
assert mpl.colors.same_color(tc, p.get_facecolor())
12751275

12761276
fig, ax = plt.subplots()
12771277
p = ax.scatter(x, x, fc='r', ec='b', label="red circles, blue edges, red label")
1278-
leg = ax.legend(loc=1, labelcolor='linecolor')
1278+
leg = ax.legend(labelcolor='linecolor')
12791279
tc = leg.texts[0].get_color()
12801280
assert mpl.colors.same_color(tc, 'r')
12811281
assert mpl.colors.same_color(tc, leg.legend_handles[0].get_facecolor())
@@ -1284,23 +1284,23 @@ def test_legend_labelcolor_linecolor_scatter():
12841284
# 'none' cases
12851285
fig, ax = plt.subplots()
12861286
p = ax.scatter(x, x, fc='none', ec='b', label="blue unfilled circles, blue label")
1287-
leg = ax.legend(loc=1, labelcolor='linecolor')
1287+
leg = ax.legend(labelcolor='linecolor')
12881288
tc = leg.texts[0].get_color()
12891289
assert mpl.colors.same_color(tc, 'b')
12901290
assert mpl.colors.same_color(tc, leg.legend_handles[0].get_edgecolor())
12911291
assert mpl.colors.same_color(tc, p.get_edgecolor())
12921292

12931293
fig, ax = plt.subplots()
12941294
p = ax.scatter(x, x, fc='r', ec='none', label="red edgeless circles, red label")
1295-
leg = ax.legend(loc=1, labelcolor='linecolor')
1295+
leg = ax.legend(labelcolor='linecolor')
12961296
tc = leg.texts[0].get_color()
12971297
assert mpl.colors.same_color(tc, 'r')
12981298
assert mpl.colors.same_color(tc, leg.legend_handles[0].get_facecolor())
12991299
assert mpl.colors.same_color(tc, p.get_facecolor())
13001300

13011301
fig, ax = plt.subplots()
13021302
p = ax.scatter(x, x, c='none', ec='none', label="invisible circles and label")
1303-
leg = ax.legend(loc=1, labelcolor='linecolor')
1303+
leg = ax.legend(labelcolor='linecolor')
13041304
tc = leg.texts[0].get_color()
13051305
assert tc == 'none'
13061306
plt.close('all')

0 commit comments

Comments
 (0)