From 213176628ad9a78f70dc856c5ab09f8db7ed779d Mon Sep 17 00:00:00 2001 From: Vincent Klein Date: Fri, 25 Jan 2019 15:53:38 +0100 Subject: [PATCH] Trac #27126: Fix plot module for python3 --- src/sage/plot/graphics.py | 12 ++++++------ src/sage/plot/histogram.py | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/sage/plot/graphics.py b/src/sage/plot/graphics.py index 603e54a430e..9b2a73add34 100644 --- a/src/sage/plot/graphics.py +++ b/src/sage/plot/graphics.py @@ -2383,10 +2383,10 @@ def _get_vmin_vmax(self, vmin, vmax, basev, axes_pad): at least 10 units apart:: sage: p = Graphics() - sage: p._get_vmin_vmax(1, 2, 10, None) - (9/10, 10.0) - sage: p._get_vmin_vmax(1, 5, 10, None) - (9/10, 10.0) + sage: p._get_vmin_vmax(1, 2, 10, None) == (9/10, 10) + True + sage: p._get_vmin_vmax(1, 5, 10, None) == (9/10, 10) + True sage: p._get_vmin_vmax(1, 10, 10, None) (9/10, 11) sage: p._get_vmin_vmax(1, 11, 10, None) @@ -2903,7 +2903,7 @@ def matplotlib(self, filename=None, if vgridlines=='minor': vgridstyle['which']='both' - if hasattr(hgridlines, '__iter__'): + if not isinstance(hgridlines, str) and hasattr(hgridlines, '__iter__'): hlines=iter(hgridlines) hgridstyle.pop("minor",None) for hline in hlines: @@ -2919,7 +2919,7 @@ def matplotlib(self, filename=None, if hgridlines not in (None, False): subplot.yaxis.grid(True, **hgridstyle) - if hasattr(vgridlines, '__iter__'): + if not isinstance(vgridlines, str) and hasattr(vgridlines, '__iter__'): vlines=iter(vgridlines) vgridstyle.pop("minor",None) for vline in vlines: diff --git a/src/sage/plot/histogram.py b/src/sage/plot/histogram.py index fc4b2046c07..8dd68e2fee8 100644 --- a/src/sage/plot/histogram.py +++ b/src/sage/plot/histogram.py @@ -92,8 +92,8 @@ def get_minmax_data(self): DeprecationWarning: the 'normed' option is deprecated. Use 'density' instead. See https://trac.sagemath.org/25260 for details. sage: h.get_minmax_data() - doctest:warning ...: - VisibleDeprecationWarning: Passing `normed=True` on non-uniform bins has always been broken, and computes neither the probability density function nor the probability mass function. The result is only correct if the bins are uniform, when density=True will produce the same result anyway. The argument will be removed in a future version of numpy. + doctest:warning ... + ...VisibleDeprecationWarning: Passing `normed=True` on non-uniform bins has always been broken, and computes neither the probability density function nor the probability mass function. The result is only correct if the bins are uniform, when density=True will produce the same result anyway. The argument will be removed in a future version of numpy. {'xmax': 10.0, 'xmin': 3.0, 'ymax': 0.476190476190..., 'ymin': 0} """ import numpy