Skip to content

Commit f649041

Browse files
committed
Deprecate is_sequence_of_strings; cleanup.
`Axes3D.scatter` no longer flattens a 2D color input.
1 parent 16bf505 commit f649041

File tree

12 files changed

+21
-46
lines changed

12 files changed

+21
-46
lines changed

examples/mplot3d/2dcollections3d_demo.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
# Fixing random state for reproducibility
2222
np.random.seed(19680801)
2323

24-
x = np.random.sample(20*len(colors))
25-
y = np.random.sample(20*len(colors))
24+
x = np.random.sample(20 * len(colors))
25+
y = np.random.sample(20 * len(colors))
2626
c_list = []
2727
for c in colors:
28-
c_list.append([c]*20)
28+
c_list.extend([c] * 20)
2929
# By using zdir='y', the y value of these points is fixed to the zs value 0
3030
# and the (x,y) points are plotted on the x and z axes.
3131
ax.scatter(x, y, zs=0, zdir='y', c=c_list, label='points in (x,z)')

lib/matplotlib/__init__.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,9 @@
122122
# definitions, so it is safe to import from it here.
123123
from . import cbook
124124
from matplotlib.cbook import (
125-
mplDeprecation,
126-
dedent, get_label,
127-
sanitize_sequence)
125+
mplDeprecation, dedent, get_label, sanitize_sequence)
128126
from matplotlib.compat import subprocess
129-
from matplotlib.rcsetup import (defaultParams,
130-
validate_backend,
131-
cycler)
127+
from matplotlib.rcsetup import defaultParams, validate_backend, cycler
132128

133129
import numpy
134130
from six.moves.urllib.request import urlopen

lib/matplotlib/axes/_axes.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616
from matplotlib import _preprocess_data
1717

1818
import matplotlib.cbook as cbook
19-
from matplotlib.cbook import (mplDeprecation, STEP_LOOKUP_MAP,
20-
iterable,
21-
safe_first_element)
19+
from matplotlib.cbook import (
20+
mplDeprecation, STEP_LOOKUP_MAP, iterable, safe_first_element)
2221
import matplotlib.collections as mcoll
2322
import matplotlib.colors as mcolors
2423
import matplotlib.contour as mcontour

lib/matplotlib/backends/backend_cairo.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ def _fn_name(): return sys._getframe(1).f_code.co_name
3535
try:
3636
import cairo
3737
except ImportError:
38-
raise ImportError("Cairo backend requires that cairocffi or pycairo is installed.")
38+
raise ImportError("Cairo backend requires that cairocffi or pycairo "
39+
"is installed.")
3940
else:
4041
HAS_CAIRO_CFFI = False
4142
else:
@@ -49,8 +50,8 @@ def _fn_name(): return sys._getframe(1).f_code.co_name
4950
backend_version = cairo.version
5051
del _version_required
5152

52-
from matplotlib.backend_bases import RendererBase, GraphicsContextBase,\
53-
FigureManagerBase, FigureCanvasBase
53+
from matplotlib.backend_bases import (
54+
RendererBase, GraphicsContextBase, FigureManagerBase, FigureCanvasBase)
5455
from matplotlib.figure import Figure
5556
from matplotlib.mathtext import MathTextParser
5657
from matplotlib.path import Path

lib/matplotlib/backends/backend_ps.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ def _fn_name(): return sys._getframe(1).f_code.co_name
1818
from matplotlib import verbose, __version__, rcParams, checkdep_ghostscript
1919
from matplotlib._pylab_helpers import Gcf
2020
from matplotlib.afm import AFM
21-
from matplotlib.backend_bases import RendererBase, GraphicsContextBase,\
22-
FigureManagerBase, FigureCanvasBase
21+
from matplotlib.backend_bases import (RendererBase, GraphicsContextBase,
22+
FigureManagerBase, FigureCanvasBase)
2323

24-
from matplotlib.cbook import get_realpath_and_stat, \
25-
is_writable_file_like, maxdict, file_requires_unicode
24+
from matplotlib.cbook import (get_realpath_and_stat, is_writable_file_like,
25+
maxdict, file_requires_unicode)
2626
from matplotlib.figure import Figure
2727

2828
from matplotlib.font_manager import findfont, is_opentype_cff_font, get_font
@@ -148,7 +148,7 @@ def _num_to_str(val):
148148
if isinstance(val, six.string_types): return val
149149

150150
ival = int(val)
151-
if val==ival: return str(ival)
151+
if val == ival: return str(ival)
152152

153153
s = "%1.3f"%val
154154
s = s.rstrip("0")

lib/matplotlib/backends/backend_wx.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@
3535
from matplotlib.backend_bases import _has_pil
3636

3737
from matplotlib._pylab_helpers import Gcf
38-
from matplotlib.cbook import ( is_writable_file_like,
39-
warn_deprecated)
38+
from matplotlib.cbook import is_writable_file_like, warn_deprecated
4039
from matplotlib.figure import Figure
4140
from matplotlib.path import Path
4241
from matplotlib.transforms import Affine2D

lib/matplotlib/blocking_input.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
import six
2929
from matplotlib import verbose
30-
from matplotlib.cbook import is_sequence_of_strings
3130
import matplotlib.lines as mlines
3231

3332
import warnings
@@ -40,8 +39,6 @@ class BlockingInput(object):
4039
"""
4140
def __init__(self, fig, eventslist=()):
4241
self.fig = fig
43-
if not is_sequence_of_strings(eventslist):
44-
raise ValueError("Requires a sequence of event name strings")
4542
self.eventslist = eventslist
4643

4744
def on_event(self, event):

lib/matplotlib/cbook/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,7 @@ def is_string_like(obj):
501501
return isinstance(obj, (six.string_types, np.str_, np.unicode_))
502502

503503

504+
@deprecated('2.1')
504505
def is_sequence_of_strings(obj):
505506
"""Returns true if *obj* is iterable and contains strings"""
506507
if not iterable(obj):

lib/matplotlib/lines.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
from . import artist, colors as mcolors, docstring, rcParams
1717
from .artist import Artist, allow_rasterization
1818
from .cbook import (
19-
iterable, is_numlike, ls_mapper, ls_mapper_r, is_hashable,
20-
STEP_LOOKUP_MAP)
19+
iterable, is_numlike, ls_mapper, ls_mapper_r, is_hashable, STEP_LOOKUP_MAP)
2120
from .markers import MarkerStyle
2221
from .path import Path
2322
from .transforms import Bbox, TransformedPath, IdentityTransform

lib/matplotlib/mathtext.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@
4444
ParserElement.enablePackrat()
4545

4646
from matplotlib.afm import AFM
47-
from matplotlib.cbook import (Bunch, get_realpath_and_stat,
48-
maxdict)
47+
from matplotlib.cbook import Bunch, get_realpath_and_stat, maxdict
4948
from matplotlib.ft2font import (FT2Image, KERNING_DEFAULT, LOAD_FORCE_AUTOHINT,
5049
LOAD_NO_HINTING)
5150
from matplotlib.font_manager import findfont, FontProperties, get_font

0 commit comments

Comments
 (0)