From beef8e279f26baa42e78fee59d93305984acd8f1 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Thu, 1 Nov 2018 12:04:30 +0100 Subject: [PATCH] Backport PR #12686: Remove deprecation warnings in tests --- lib/matplotlib/axes/_axes.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 2027d250a8a0..f41c4628c972 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -4,6 +4,10 @@ import six from six.moves import xrange, zip, zip_longest +try: + import collections.abc as collections_abc +except ImportError: + import collections as collections_abc import functools import itertools import logging @@ -4268,7 +4272,11 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None, # c is an array for mapping. The potential ambiguity # with a sequence of 3 or 4 numbers is resolved in # favor of mapping, not rgb or rgba. - if c_none or co is not None: + if (c_none or + co is not None or + isinstance(c, six.string_types) or + (isinstance(c, collections_abc.Iterable) and + isinstance(c[0], six.string_types))): c_array = None else: try: