10000 ENH: allow list of grey strings · matplotlib/matplotlib@3243ba8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3243ba8

Browse files
committed
ENH: allow list of grey strings
1 parent e5421ab commit 3243ba8

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import collections
12
import functools
23
import itertools
34
import logging
@@ -4184,7 +4185,11 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
41844185
valid_shape = True # will be put to the test!
41854186
n_elem = -1 # used only for (some) exceptions
41864187

4187-
if c_none or co is not None or isinstance(c, str):
4188+
if (c_none or
4189+
co is not None or
4190+
isinstance(c, str) or
4191+
(isinstance(c, collections.Iterable) and
4192+
isinstance(c[0], str))):
41884193
c_array = None
41894194
else:
41904195
try: # First, does 'c' look suitable for value-mapping?

setup.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@
1515
error = """
1616
Matplotlib 3.0+ does not support Python 2.x, 3.0, 3.1, 3.2, 3.3, or 3.4.
1717
Beginning with Matplotlib 3.0, Python 3.5 and above is required.
18-
1918
This may be due to an out of date pip.
20-
2119
Make sure you have pip >= 9.0.1.
2220
"""
2321
sys.exit(error)
2422

23+
import subprocess
2524
# The setuptools version of sdist adds a setup.cfg file to the tree.
2625
# We don't want that, so we simply remove it, and it will fall back to
2726
# vanilla distutils.
@@ -105,10 +104,27 @@ def build_extensions(self):
105104
self.compiler.compiler_so.remove('-Wstrict-prototypes')
106105
except (ValueError, AttributeError):
107106
pass
107+
if self._xcode_gte_10():
108+
# If compiling using Xcode >= 10, need to manually specify the
109+
# -stdlib flag because libstdc++ is no longer available
110+
for mod in self.distribution.ext_modules:
111+
mod.extra_compile_args = ['-stdlib=libc++']
112+
mod.extra_link_args = ['-stdlib=libc++']
108113
for package in good_packages:
109114
package.do_custom_build()
110115
return super().build_extensions()
111116

117+
def _xcode_gte_10(self):
118+
if sys.platform != "darwin":
119+
return False
120+
# Returns True if compiler is from Xcode version >= 10
121+
compiler_version = str(subprocess.check_output(
122+
self.compiler.compiler + ['--version'], universal_newlines=True))
123+
compiler_version = compiler_version.split(' ')
124+
return ((compiler_version[0] == 'Apple') and
125+
(compiler_version[1] == 'LLVM') and
126+
(int(compiler_version[3].split('.')[0]) >= 10))
127+
112128

113129
cmdclass = versioneer.get_cmdclass()
114130
cmdclass['test'] = NoopTestCommand

0 commit comments

Comments
 (0)
0