Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/v1.5.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
mdboom committed Oct 20, 2015
2 parents 0c59ed1 + 95e2346 commit 5a4faa2
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 27 deletions.
30 changes: 14 additions & 16 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
from matplotlib import unpack_labeled_data

import matplotlib.cbook as cbook
from matplotlib.cbook import mplDeprecation, STEP_LOOKUP_MAP
from matplotlib.cbook import (mplDeprecation, STEP_LOOKUP_MAP,
iterable, is_string_like)
import matplotlib.collections as mcoll
import matplotlib.colors as mcolors
import matplotlib.contour as mcontour
Expand Down Expand Up @@ -43,10 +44,6 @@

rcParams = matplotlib.rcParams

iterable = cbook.iterable
is_string_like = cbook.is_string_like
is_sequence_of_strings = cbook.is_sequence_of_strings


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

tick_label = kwargs.pop('tick_label', None)
label_ticks_flag = tick_label is not None

# Because xerr and yerr will be passed to errorbar,
# most dimension checking and processing will be left
# to the errorbar method.
Expand All @@ -2001,6 +1995,7 @@ def bar(self, left, height, width=0.8, bottom=None, **kwargs):
orientation = kwargs.pop('orientation', 'vertical')
log = kwargs.pop('log', False)
label = kwargs.pop('label', '')
tick_labels = kwargs.pop('tick_label', None)

def make_iterable(x):
if not iterable(x):
Expand All @@ -2016,7 +2011,6 @@ def make_iterable(x):
_bottom = bottom
bottom = make_iterable(bottom)
linewidth = make_iterable(linewidth)
tick_label = make_iterable(tick_label)

adjust_ylim = False
adjust_xlim = False
Expand Down Expand Up @@ -2061,8 +2055,6 @@ def make_iterable(x):

if len(linewidth) < nbars:
linewidth *= nbars
if len(tick_label) < nbars:
tick_label *= nbars

if color is None:
color = [None] * nbars
Expand Down Expand Up @@ -2095,9 +2087,6 @@ def make_iterable(x):
if len(bottom) != nbars:
raise ValueError("incompatible sizes: argument 'bottom' "
"must be length %d or scalar" % nbars)
if len(tick_label) != nbars:
raise ValueError("incompatible sizes: argument 'tick_label' "
"must be length %d or string" % nbars)

patches = []

Expand Down Expand Up @@ -2193,9 +2182,18 @@ def make_iterable(x):
bar_container = BarContainer(patches, errorbar, label=label)
self.add_container(bar_container)

if label_ticks_flag:
if tick_labels is not None:
tick_labels = make_iterable(tick_labels)
if isinstance(tick_labels, six.string_types):
tick_labels = [tick_labels]
if len(tick_labels) == 1:
tick_labels *= nbars
if len(tick_labels) != nbars:
raise ValueError("incompatible sizes: argument 'tick_label' "
"must be length %d or string" % nbars)

tick_label_axis.set_ticks(tick_label_position)
tick_label_axis.set_ticklabels(tick_label)
tick_label_axis.set_ticklabels(tick_labels)

return bar_container

Expand Down
3 changes: 0 additions & 3 deletions lib/matplotlib/fontconfig_pattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
information.
"""

# Author : Michael Droettboom <mdroe@stsci.edu>
# License : matplotlib license (PSF compatible)

# This class is defined here because it must be available in:
# - The old-style config framework (:file:`rcsetup.py`)
# - The traits-based config framework (:file:`mpltraits.py`)
Expand Down
6 changes: 2 additions & 4 deletions lib/matplotlib/lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -717,10 +717,8 @@ def draw(self, renderer):
i0, = self._x_filled.searchsorted([x0], 'left')
i1, = self._x_filled.searchsorted([x1], 'right')
subslice = slice(max(i0 - 1, 0), i1 + 1)
# Don't remake the Path unless it will be sufficiently smaller.
if subslice.start > 100 or len(self._x) - subslice.stop > 100:
self.ind_offset = subslice.start
self._transform_path(subslice)
self.ind_offset = subslice.start
self._transform_path(subslice)

transf_path = self._get_transformed_path()

Expand Down
3 changes: 0 additions & 3 deletions lib/matplotlib/mathtext.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
fonts are supported. There is experimental support for using
arbitrary fonts, but results may vary without proper tweaking and
metrics for those fonts.
If you find TeX expressions that don't parse or render properly,
please email mdroe@stsci.edu, but please check KNOWN ISSUES below first.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
Expand Down
7 changes: 7 additions & 0 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1055,6 +1055,12 @@ def test_bar_tick_label_single():
ax.bar("a", "b" , tick_label='a', data=data)


@cleanup
def test_bar_ticklabel_fail():
fig, ax = plt.subplots()
ax.bar([], [])


@image_comparison(baseline_images=['bar_tick_label_multiple'],
extensions=['png'])
def test_bar_tick_label_multiple():
Expand Down Expand Up @@ -1082,6 +1088,7 @@ def test_hist_log():
ax = fig.add_subplot(111)
ax.hist(data, fill=False, log=True)


@image_comparison(baseline_images=['hist_bar_empty'], remove_text=True,
extensions=['png'])
def test_hist_bar_empty():
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ def run_tests(self):
version=__version__,
description="Python plotting package",
author="John D. Hunter, Michael Droettboom",
author_email="mdroe@stsci.edu",
author_email="matplotlib-users@python.org",
url="http://matplotlib.org",
long_description="""
matplotlib strives to produce publication quality 2D graphics
Expand Down

0 comments on commit 5a4faa2

Please sign in to comment.