diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index ab054599008a..e7e97330a27d 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -44,6 +44,17 @@ rcParams = matplotlib.rcParams +_alias_map = {'color': ['c'], + 'linewidth': ['lw'], + 'linestyle': ['ls'], + 'facecolor': ['fc'], + 'edgecolor': ['ec'], + 'markerfacecolor': ['mfc'], + 'markeredgecolor': ['mec'], + 'markeredgewidth': ['mew'], + 'markersize': ['ms'], + } + def _plot_args_replacer(args, data): if len(args) == 1: @@ -1415,11 +1426,7 @@ def plot(self, *args, **kwargs): self.cla() lines = [] - # Convert "c" alias to "color" immediately, to avoid - # confusion farther on. - c = kwargs.pop('c', None) - if c is not None: - kwargs['color'] = c + kwargs = cbook.normalize_kwargs(kwargs, _alias_map) for line in self._get_lines(*args, **kwargs): self.add_line(line) @@ -4537,6 +4544,8 @@ def fill(self, *args, **kwargs): if not self._hold: self.cla() + kwargs = cbook.normalize_kwargs(kwargs, _alias_map) + patches = [] for poly in self._get_patches_for_fill(*args, **kwargs): self.add_patch(poly) diff --git a/lib/matplotlib/tests/baseline_images/test_cycles/property_collision_fill.png b/lib/matplotlib/tests/baseline_images/test_cycles/property_collision_fill.png new file mode 100644 index 000000000000..850373af30da Binary files /dev/null and b/lib/matplotlib/tests/baseline_images/test_cycles/property_collision_fill.png differ diff --git a/lib/matplotlib/tests/baseline_images/test_cycles/property_collision_plot.png b/lib/matplotlib/tests/baseline_images/test_cycles/property_collision_plot.png new file mode 100644 index 000000000000..2c962c843f64 Binary files /dev/null and b/lib/matplotlib/tests/baseline_images/test_cycles/property_collision_plot.png differ diff --git a/lib/matplotlib/tests/test_cycles.py b/lib/matplotlib/tests/test_cycles.py index 074b68a276f2..842b35af756e 100644 --- a/lib/matplotlib/tests/test_cycles.py +++ b/lib/matplotlib/tests/test_cycles.py @@ -123,6 +123,30 @@ def test_fillcycle_ignore(): ax.legend(loc='upper left') +@image_comparison(baseline_images=['property_collision_plot'], + remove_text=True, extensions=['png']) +def test_property_collision_plot(): + fig, ax = plt.subplots() + ax.set_prop_cycle('linewidth', [2, 4]) + for c in range(1, 4): + ax.plot(np.arange(10), c * np.arange(10), lw=0.1) + ax.plot(np.arange(10), 4 * np.arange(10)) + ax.plot(np.arange(10), 5 * np.arange(10)) + + +@image_comparison(baseline_images=['property_collision_fill'], + remove_text=True, extensions=['png']) +def test_property_collision_fill(): + fig, ax = plt.subplots() + xs = np.arange(10) + ys = 0.25 * xs**.5 + 2 + ax.set_prop_cycle(linewidth=[2, 3, 4, 5, 6], facecolor='bgcmy') + for c in range(1, 4): + ax.fill(xs, c * ys, lw=0.1) + ax.fill(xs, 4 * ys) + ax.fill(xs, 5 * ys) + + @cleanup def test_valid_input_forms(): fig, ax = plt.subplots()
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: