From 562b18efb4c54c3be6470674b644ce30af4659a7 Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Tue, 8 Mar 2016 17:17:48 +0000 Subject: [PATCH 1/7] Remove unused code --- lib/matplotlib/artist.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/lib/matplotlib/artist.py b/lib/matplotlib/artist.py index 0ab4f681986..c59332e1c7c 100644 --- a/lib/matplotlib/artist.py +++ b/lib/matplotlib/artist.py @@ -1363,14 +1363,6 @@ def pprint_setters_rest(self, prop=None, leadingspace=2): lines.append(table_formatstr) lines.append('') return lines - ######## - - for prop, path in attrs: - accepts = self.get_valid_values(prop) - name = self.aliased_name_rest(prop, path) - - lines.append('%s%s: %s' % (pad, name, accepts)) - return lines def properties(self): """ From 2d3de46e9475636ecc13d0db4a71e3c00d1319ee Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Tue, 8 Mar 2016 17:23:59 +0000 Subject: [PATCH 2/7] Remove duplicated imports --- doc/pyplots/whats_new_98_4_legend.py | 4 ---- examples/lines_bars_and_markers/barh_demo.py | 3 +-- examples/shapes_and_collections/artist_reference.py | 4 +--- lib/matplotlib/testing/jpl_units/__init__.py | 4 ---- lib/matplotlib/tests/test_axes.py | 1 - lib/matplotlib/tests/test_simplification.py | 1 - lib/mpl_toolkits/axisartist/__init__.py | 2 +- 7 files changed, 3 insertions(+), 16 deletions(-) diff --git a/doc/pyplots/whats_new_98_4_legend.py b/doc/pyplots/whats_new_98_4_legend.py index 2a806126f3c..6ba35e52d12 100644 --- a/doc/pyplots/whats_new_98_4_legend.py +++ b/doc/pyplots/whats_new_98_4_legend.py @@ -1,6 +1,5 @@ import matplotlib.pyplot as plt import numpy as np -import matplotlib.pyplot as plt ax = plt.subplot(111) @@ -13,6 +12,3 @@ plt.show() - - - diff --git a/examples/lines_bars_and_markers/barh_demo.py b/examples/lines_bars_and_markers/barh_demo.py index 01993e95686..27d2c704156 100644 --- a/examples/lines_bars_and_markers/barh_demo.py +++ b/examples/lines_bars_and_markers/barh_demo.py @@ -2,9 +2,8 @@ Simple demo of a horizontal bar chart. """ import matplotlib.pyplot as plt -plt.rcdefaults() import numpy as np -import matplotlib.pyplot as plt +plt.rcdefaults() # Example data diff --git a/examples/shapes_and_collections/artist_reference.py b/examples/shapes_and_collections/artist_reference.py index fc22645c642..440c50eba51 100644 --- a/examples/shapes_and_collections/artist_reference.py +++ b/examples/shapes_and_collections/artist_reference.py @@ -9,14 +9,12 @@ BSD License """ import matplotlib.pyplot as plt -plt.rcdefaults() - import numpy as np -import matplotlib.pyplot as plt import matplotlib.path as mpath import matplotlib.lines as mlines import matplotlib.patches as mpatches from matplotlib.collections import PatchCollection +plt.rcdefaults() def label(xy, text): diff --git a/lib/matplotlib/testing/jpl_units/__init__.py b/lib/matplotlib/testing/jpl_units/__init__.py index e371b9ac531..902766f46c2 100644 --- a/lib/matplotlib/testing/jpl_units/__init__.py +++ b/lib/matplotlib/testing/jpl_units/__init__.py @@ -40,10 +40,6 @@ from .Epoch import Epoch from .UnitDbl import UnitDbl -from .Duration import Duration -from .Epoch import Epoch -from .UnitDbl import UnitDbl - from .StrConverter import StrConverter from .EpochConverter import EpochConverter from .UnitDblConverter import UnitDblConverter diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index d23a01fd8c2..a9163dc9bd3 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -25,7 +25,6 @@ import matplotlib.pyplot as plt import matplotlib.markers as mmarkers from numpy.testing import assert_allclose, assert_array_equal -import warnings from matplotlib.cbook import IgnoredKeywordWarning import sys diff --git a/lib/matplotlib/tests/test_simplification.py b/lib/matplotlib/tests/test_simplification.py index ac0ef91f2a4..27fe3794cf3 100644 --- a/lib/matplotlib/tests/test_simplification.py +++ b/lib/matplotlib/tests/test_simplification.py @@ -9,7 +9,6 @@ import matplotlib.pyplot as plt from pylab import * -import numpy as np from matplotlib import patches, path, transforms from nose.tools import raises diff --git a/lib/mpl_toolkits/axisartist/__init__.py b/lib/mpl_toolkits/axisartist/__init__.py index 74da18a64e9..d7d20e98999 100644 --- a/lib/mpl_toolkits/axisartist/__init__.py +++ b/lib/mpl_toolkits/axisartist/__init__.py @@ -4,7 +4,7 @@ from matplotlib.externals import six from .axislines import Axes, Subplot, AxesZero, SubplotZero, GridHelperRectlinear, \ - AxisArtistHelperRectlinear, AxisArtistHelper, GridHelperBase, AxisArtist + AxisArtistHelperRectlinear, AxisArtistHelper, GridHelperBase from .axis_artist import AxisArtist, GridlinesCollection from .grid_helper_curvelinear import GridHelperCurveLinear From ffe02bae6878fb71d1da3b5445b9bd4b91abf5ea Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Tue, 8 Mar 2016 17:39:20 +0000 Subject: [PATCH 3/7] Remove duplicated dict keys Fortunatly they are all the same in different representations --- lib/matplotlib/_mathtext_data.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/matplotlib/_mathtext_data.py b/lib/matplotlib/_mathtext_data.py index 81e1f579f3a..000829b599d 100644 --- a/lib/matplotlib/_mathtext_data.py +++ b/lib/matplotlib/_mathtext_data.py @@ -348,7 +348,6 @@ r'\Rightarrow' : ('psyr', 222), r'\Downarrow' : ('psyr', 223), r'\Diamond' : ('psyr', 224), - r'\langle' : ('psyr', 225), r'\Sigma' : ('psyr', 229), r'\sum' : ('psyr', 229), r'\forall' : ('psyr', 34), @@ -2111,7 +2110,6 @@ 'pitchfork' : 8916, 'blacktriangleleft' : 9664, 'nprec' : 8832, - 'vdots' : 8942, 'curvearrowright' : 8631, 'barwedge' : 8892, 'multimap' : 8888, @@ -2138,7 +2136,6 @@ 'Im' : 8465, 'curvearrowleft' : 8630, 'wedgeq' : 8793, - 'fallingdotseq' : 8786, 'curlyeqprec' : 8926, 'questeq' : 8799, 'less' : 60, From d36412f0dc0b629e6797a917038fa3aa6c8af195 Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Tue, 8 Mar 2016 17:41:06 +0000 Subject: [PATCH 4/7] Remove duplicated rcsetup entries --- lib/matplotlib/rcsetup.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/matplotlib/rcsetup.py b/lib/matplotlib/rcsetup.py index a7c56be6f25..9e46fefcbd3 100644 --- a/lib/matplotlib/rcsetup.py +++ b/lib/matplotlib/rcsetup.py @@ -1065,12 +1065,10 @@ def validate_animation_writer_path(p): # the number of points in the legend line for scatter 'legend.scatterpoints': [3, validate_int], 'legend.fontsize': ['large', validate_fontsize], - # the relative size of legend markers vs. original - 'legend.markerscale': [1.0, validate_float], - 'legend.shadow': [False, validate_bool], - # whether or not to draw a frame around legend + + # whether or not to draw a frame around legend 'legend.frameon': [True, validate_bool], - # alpha value of the legend frame + # alpha value of the legend frame 'legend.framealpha': [None, validate_float_or_None], ## the following dimensions are in fraction of the font size From 09aba5b3c91636e2c071ab61138af0c5baa1713e Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Tue, 8 Mar 2016 17:45:26 +0000 Subject: [PATCH 5/7] Make debug statement make sense Original code could never run --- lib/matplotlib/backends/backend_gtkagg.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/backends/backend_gtkagg.py b/lib/matplotlib/backends/backend_gtkagg.py index 8acaa5a0113..eb8b4f75cab 100644 --- a/lib/matplotlib/backends/backend_gtkagg.py +++ b/lib/matplotlib/backends/backend_gtkagg.py @@ -51,8 +51,9 @@ def new_figure_manager_given_figure(num, figure): Create a new figure manager instance for the given figure. """ canvas = FigureCanvasGTKAgg(figure) - return FigureManagerGTKAgg(canvas, num) + figuremanager = FigureManagerGTKAgg(canvas, num) if DEBUG: print('backend_gtkagg.new_figure_manager done') + return figuremanager class FigureCanvasGTKAgg(FigureCanvasGTK, FigureCanvasAgg): From 8ff0cc2864917f55f72e94e6a5880615ae92d05f Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Mon, 21 Mar 2016 13:11:55 +0000 Subject: [PATCH 6/7] Comments by QuLogic --- examples/lines_bars_and_markers/barh_demo.py | 3 ++- examples/shapes_and_collections/artist_reference.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/lines_bars_and_markers/barh_demo.py b/examples/lines_bars_and_markers/barh_demo.py index 27d2c704156..965d135b43a 100644 --- a/examples/lines_bars_and_markers/barh_demo.py +++ b/examples/lines_bars_and_markers/barh_demo.py @@ -3,9 +3,10 @@ """ import matplotlib.pyplot as plt import numpy as np -plt.rcdefaults() +plt.rcdefaults() + # Example data people = ('Tom', 'Dick', 'Harry', 'Slim', 'Jim') y_pos = np.arange(len(people)) diff --git a/examples/shapes_and_collections/artist_reference.py b/examples/shapes_and_collections/artist_reference.py index 440c50eba51..c85a57bf654 100644 --- a/examples/shapes_and_collections/artist_reference.py +++ b/examples/shapes_and_collections/artist_reference.py @@ -14,6 +14,8 @@ import matplotlib.lines as mlines import matplotlib.patches as mpatches from matplotlib.collections import PatchCollection + + plt.rcdefaults() From 3cb778728f9a8c45014eb4d20007aa233aa13dec Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Mon, 21 Mar 2016 13:37:14 +0000 Subject: [PATCH 7/7] Remove use of pylab from tests --- lib/matplotlib/tests/test_simplification.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/matplotlib/tests/test_simplification.py b/lib/matplotlib/tests/test_simplification.py index 27fe3794cf3..a313fdc0c97 100644 --- a/lib/matplotlib/tests/test_simplification.py +++ b/lib/matplotlib/tests/test_simplification.py @@ -8,7 +8,6 @@ from matplotlib.testing.decorators import image_comparison, knownfailureif, cleanup import matplotlib.pyplot as plt -from pylab import * from matplotlib import patches, path, transforms from nose.tools import raises @@ -23,7 +22,7 @@ @image_comparison(baseline_images=['clipping'], remove_text=True) def test_clipping(): t = np.arange(0.0, 2.0, 0.01) - s = np.sin(2*pi*t) + s = np.sin(2*np.pi*t) fig = plt.figure() ax = fig.add_subplot(111) @@ -100,16 +99,16 @@ def test_simplify_curve(): def test_hatch(): fig = plt.figure() ax = fig.add_subplot(111) - ax.add_patch(Rectangle((0, 0), 1, 1, fill=False, hatch="/")) + ax.add_patch(plt.Rectangle((0, 0), 1, 1, fill=False, hatch="/")) ax.set_xlim((0.45, 0.55)) ax.set_ylim((0.45, 0.55)) @image_comparison(baseline_images=['fft_peaks'], remove_text=True) def test_fft_peaks(): fig = plt.figure() - t = arange(65536) + t = np.arange(65536) ax = fig.add_subplot(111) - p1 = ax.plot(abs(fft(sin(2*pi*.01*t)*blackman(len(t))))) + p1 = ax.plot(abs(np.fft.fft(np.sin(2*np.pi*.01*t)*np.blackman(len(t))))) path = p1[0].get_path() transform = p1[0].get_transform() @@ -162,7 +161,7 @@ def test_start_with_moveto(): @cleanup @raises(OverflowError) def test_throw_rendering_complexity_exceeded(): - rcParams['path.simplify'] = False + plt.rcParams['path.simplify'] = False xx = np.arange(200000) yy = np.random.rand(200000) yy[1000] = np.nan @@ -172,7 +171,7 @@ def test_throw_rendering_complexity_exceeded(): try: fig.savefig(io.BytesIO()) finally: - rcParams['path.simplify'] = True + plt.rcParams['path.simplify'] = True @image_comparison(baseline_images=['clipper_edge'], remove_text=True) def test_clipper():