Skip to content

Commit a38e1da

Browse files
committed
Merge remote-tracking branch 'upstream/v1.5.x' into v2.x
2 parents 2ec3780 + ed0b475 commit a38e1da

File tree

6 files changed

+49
-8
lines changed

6 files changed

+49
-8
lines changed

lib/matplotlib/axes/_axes.py

+16-7
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,17 @@
4545

4646
rcParams = matplotlib.rcParams
4747

48+
_alias_map = {'color': ['c'],
49+
'linewidth': ['lw'],
50+
'linestyle': ['ls'],
51+
'facecolor': ['fc'],
52+
'edgecolor': ['ec'],
53+
'markerfacecolor': ['mfc'],
54+
'markeredgecolor': ['mec'],
55+
'markeredgewidth': ['mew'],
56+
'markersize': ['ms'],
57+
}
58+
4859

4960
def _plot_args_replacer(args, data):
5061
if len(args) == 1:
@@ -1416,11 +1427,7 @@ def plot(self, *args, **kwargs):
14161427
self.cla()
14171428
lines = []
14181429

1419-
# Convert "c" alias to "color" immediately, to avoid
1420-
# confusion farther on.
1421-
c = kwargs.pop('c', None)
1422-
if c is not None:
1423-
kwargs['color'] = c
1430+
kwargs = cbook.normalize_kwargs(kwargs, _alias_map)
14241431

14251432
for line in self._get_lines(*args, **kwargs):
14261433
self.add_line(line)
@@ -3172,8 +3179,8 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,
31723179
``shownotches`` is also True. Otherwise, means will be shown
31733180
as points.
31743181
3175-
Additional Options
3176-
---------------------
3182+
Other Parameters
3183+
----------------
31773184
The following boolean options toggle the drawing of individual
31783185
components of the boxplots:
31793186
- showcaps: the caps on the ends of whiskers
@@ -4574,6 +4581,8 @@ def fill(self, *args, **kwargs):
45744581
if not self._hold:
45754582
self.cla()
45764583

4584+
kwargs = cbook.normalize_kwargs(kwargs, _alias_map)
4585+
45774586
patches = []
45784587
for poly in self._get_patches_for_fill(*args, **kwargs):
45794588
self.add_patch(poly)

lib/matplotlib/patches.py

-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ def update_from(self, other):
184184
self.set_linewidth(other.get_linewidth())
185185
self.set_linestyle(other.get_linestyle())
186186
self.set_transform(other.get_data_transform())
187-
self.set_figure(other.get_figure())
188187
self.set_alpha(other.get_alpha())
189188

190189
def get_extents(self):

lib/matplotlib/tests/test_cycles.py

+24
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,30 @@ def test_fillcycle_ignore():
123123
ax.legend(loc='upper left')
124124

125125

126+
@image_comparison(baseline_images=['property_collision_plot'],
127+
remove_text=True, extensions=['png'])
128+
def test_property_collision_plot():
129+
fig, ax = plt.subplots()
130+
ax.set_prop_cycle('linewidth', [2, 4])
131+
for c in range(1, 4):
132+
ax.plot(np.arange(10), c * np.arange(10), lw=0.1)
133+
ax.plot(np.arange(10), 4 * np.arange(10))
134+
ax.plot(np.arange(10), 5 * np.arange(10))
135+
136+
137+
@image_comparison(baseline_images=['property_collision_fill'],
138+
remove_text=True, extensions=['png'])
139+
def test_property_collision_fill():
140+
fig, ax = plt.subplots()
141+
xs = np.arange(10)
142+
ys = 0.25 * xs**.5 + 2
143+
ax.set_prop_cycle(linewidth=[2, 3, 4, 5, 6], facecolor='bgcmy')
144+
for c in range(1, 4):
145+
ax.fill(xs, c * ys, lw=0.1)
146+
ax.fill(xs, 4 * ys)
147+
ax.fill(xs, 5 * ys)
148+
149+
126150
@cleanup
127151
def test_valid_input_forms():
128152
fig, ax = plt.subplots()

lib/matplotlib/tests/test_legend.py

+9
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,15 @@ def test_legend_stackplot():
241241
ax.legend(loc=0)
242242

243243

244+
@cleanup
245+
def test_cross_figure_patch_legend():
246+
fig, ax = plt.subplots()
247+
fig2, ax2 = plt.subplots()
248+
249+
brs = ax.bar(range(3), range(3))
250+
fig2.legend(brs, 'foo')
251+
252+
244253
@cleanup
245254
def test_nanscatter():
246255
fig, ax = plt.subplots()

0 commit comments

Comments
 (0)