From a33be777cb70af994964009f101b8fd8cae32935 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Wed, 21 Dec 2016 17:53:58 +0000 Subject: [PATCH 1/3] Check if aspect is a string to avoid comparing numpy array to tuple of strings --- lib/matplotlib/axes/_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index 669f72030f7a..7b46bbddc84e 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -1282,7 +1282,7 @@ def set_aspect(self, aspect, adjustable=None, anchor=None): etc. ===== ===================== """ - if aspect in ('equal', 'auto'): + if isinstance(aspect, str) and aspect in ('equal', 'auto'): self._aspect = aspect else: self._aspect = float(aspect) # raise ValueError if necessary From abcef5afd54ec54029732660397c820c14fe063c Mon Sep 17 00:00:00 2001 From: David Stansby Date: Thu, 22 Dec 2016 12:07:32 +0000 Subject: [PATCH 2/3] Use cbook string class checker --- lib/matplotlib/axes/_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index 7b46bbddc84e..72a6d50474cf 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -1282,7 +1282,7 @@ def set_aspect(self, aspect, adjustable=None, anchor=None): etc. ===== ===================== """ - if isinstance(aspect, str) and aspect in ('equal', 'auto'): + if cbook.is_string_like(aspect) and aspect in ('equal', 'auto'): self._aspect = aspect else: self._aspect = float(aspect) # raise ValueError if necessary From 42786e378cd78fdd9b2ff4722b7b3fe769190d5d Mon Sep 17 00:00:00 2001 From: David Stansby Date: Thu, 22 Dec 2016 12:22:09 +0000 Subject: [PATCH 3/3] Avoid comparing numpy array to string when marker is an array --- lib/matplotlib/lines.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/lines.py b/lib/matplotlib/lines.py index 5e9435a38ac2..1310c080b085 100644 --- a/lib/matplotlib/lines.py +++ b/lib/matplotlib/lines.py @@ -840,11 +840,13 @@ def draw(self, renderer): marker_path = marker.get_path() marker_trans = marker.get_transform() w = renderer.points_to_pixels(self._markersize) - if marker.get_marker() != ',': + + if (is_string_like(marker.get_marker()) and + marker.get_marker() == ','): + gc.set_linewidth(0) + else: # Don't scale for pixels, and don't stroke them marker_trans = marker_trans.scale(w) - else: - gc.set_linewidth(0) renderer.draw_markers(gc, marker_path, marker_trans, subsampled, affine.frozen(),