Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5a4faa2

Browse files
committed
Merge remote-tracking branch 'upstream/v1.5.x'
2 parents 0c59ed1 + 95e2346 commit 5a4faa2

File tree

6 files changed

+24
-27
lines changed

6 files changed

+24
-27
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
from matplotlib import unpack_labeled_data
1515

1616
import matplotlib.cbook as cbook
17-
from matplotlib.cbook import mplDeprecation, STEP_LOOKUP_MAP
17+
from matplotlib.cbook import (mplDeprecation, STEP_LOOKUP_MAP,
18+
iterable, is_string_like)
1819
import matplotlib.collections as mcoll
1920
import matplotlib.colors as mcolors
2021
import matplotlib.contour as mcontour
@@ -43,10 +44,6 @@
4344

4445
rcParams = matplotlib.rcParams
4546

46-
iterable = cbook.iterable
47-
is_string_like = cbook.is_string_like
48-
is_sequence_of_strings = cbook.is_sequence_of_strings
49-
5047

5148
def _plot_args_replacer(args, data):
5249
if len(args) == 1:
@@ -1983,9 +1980,6 @@ def bar(self, left, height, width=0.8, bottom=None, **kwargs):
19831980
edgecolor = kwargs.pop('edgecolor', None)
19841981
linewidth = kwargs.pop('linewidth', None)
19851982

1986-
tick_label = kwargs.pop('tick_label', None)
1987-
label_ticks_flag = tick_label is not None
1988-
19891983
# Because xerr and yerr will be passed to errorbar,
19901984
# most dimension checking and processing will be left
19911985
# to the errorbar method.
@@ -2001,6 +1995,7 @@ def bar(self, left, height, width=0.8, bottom=None, **kwargs):
20011995
orientation = kwargs.pop('orientation', 'vertical')
20021996
log = kwargs.pop('log', False)
20031997
label = kwargs.pop('label', '')
1998+
tick_labels = kwargs.pop('tick_label', None)
20041999

20052000
def make_iterable(x):
20062001
if not iterable(x):
@@ -2016,7 +2011,6 @@ def make_iterable(x):
20162011
_bottom = bottom
20172012
bottom = make_iterable(bottom)
20182013
linewidth = make_iterable(linewidth)
2019-
tick_label = make_iterable(tick_label)
20202014

20212015
adjust_ylim = False
20222016
adjust_xlim = False
@@ -2061,8 +2055,6 @@ def make_iterable(x):
20612055

20622056
if len(linewidth) < nbars:
20632057
linewidth *= nbars
2064-
if len(tick_label) < nbars:
2065-
tick_label *= nbars
20662058

20672059
if color is None:
20682060
color = [None] * nbars
@@ -2095,9 +2087,6 @@ def make_iterable(x):
20952087
if len(bottom) != nbars:
20962088
raise ValueError("incompatible sizes: argument 'bottom' "
20972089
"must be length %d or scalar" % nbars)
2098-
if len(tick_label) != nbars:
2099-
raise ValueError("incompatible sizes: argument 'tick_label' "
2100-
"must be length %d or string" % nbars)
21012090

21022091
patches = []
21032092

@@ -2193,9 +2182,18 @@ def make_iterable(x):
21932182
bar_container = BarContainer(patches, errorbar, label=label)
21942183
self.add_container(bar_container)
21952184

2196-
if label_ticks_flag:
2185+
if tick_labels is not None:
2186+
tick_labels = make_iterable(tick_labels)
2187+
if isinstance(tick_labels, six.string_types):
2188+
tick_labels = [tick_labels]
2189+
if len(tick_labels) == 1:
2190+
tick_labels *= nbars
2191+
if len(tick_labels) != nbars:
2192+
raise ValueError("incompatible sizes: argument 'tick_label' "
2193+
"must be length %d or string" % nbars)
2194+
21972195
tick_label_axis.set_ticks(tick_label_position)
2198-
tick_label_axis.set_ticklabels(tick_label)
2196+
tick_label_axis.set_ticklabels(tick_labels)
21992197

22002198
return bar_container
22012199

lib/matplotlib/fontconfig_pattern.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
information.
77
"""
88

9-
# Author : Michael Droettboom <[email protected]>
10-
# License : matplotlib license (PSF compatible)
11-
129
# This class is defined here because it must be available in:
1310
# - The old-style config framework (:file:`rcsetup.py`)
1411
# - The traits-based config framework (:file:`mpltraits.py`)

lib/matplotlib/lines.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -717,10 +717,8 @@ def draw(self, renderer):
717717
i0, = self._x_filled.searchsorted([x0], 'left')
718718
i1, = self._x_filled.searchsorted([x1], 'right')
719719
subslice = slice(max(i0 - 1, 0), i1 + 1)
720-
# Don't remake the Path unless it will be sufficiently smaller.
721-
if subslice.start > 100 or len(self._x) - subslice.stop > 100:
722-
self.ind_offset = subslice.start
723-
self._transform_path(subslice)
720+
self.ind_offset = subslice.start
721+
self._transform_path(subslice)
724722

725723
transf_path = self._get_transformed_path()
726724

lib/matplotlib/mathtext.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
fonts are supported. There is experimental support for using
1414
arbitrary fonts, but results may vary without proper tweaking and
1515
metrics for those fonts.
16-
17-
If you find TeX expressions that don't parse or render properly,
18-
please email [email protected], but please check KNOWN ISSUES below first.
1916
"""
2017
from __future__ import (absolute_import, division, print_function,
2118
unicode_literals)

lib/matplotlib/tests/test_axes.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,6 +1055,12 @@ def test_bar_tick_label_single():
10551055
ax.bar("a", "b" , tick_label='a', data=data)
10561056

10571057

1058+
@cleanup
1059+
def test_bar_ticklabel_fail():
1060+
fig, ax = plt.subplots()
1061+
ax.bar([], [])
1062+
1063+
10581064
@image_comparison(baseline_images=['bar_tick_label_multiple'],
10591065
extensions=['png'])
10601066
def test_bar_tick_label_multiple():
@@ -1082,6 +1088,7 @@ def test_hist_log():
10821088
ax = fig.add_subplot(111)
10831089
ax.hist(data, fill=False, log=True)
10841090

1091+
10851092
@image_comparison(baseline_images=['hist_bar_empty'], remove_text=True,
10861093
extensions=['png'])
10871094
def test_hist_bar_empty():

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ def run_tests(self):
348348
version=__version__,
349349
description="Python plotting package",
350350
author="John D. Hunter, Michael Droettboom",
351-
author_email="[email protected]",
351+
author_email="[email protected]",
352352
url="http://matplotlib.org",
353353
long_description="""
354354
matplotlib strives to produce publication quality 2D graphics

0 commit comments

Comments
 (0)