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

Skip to content

Commit 4e725b8

Browse files
committed
Merge pull request #6154 from jenshnielsen/quantifiedcodecleanup
Some small cleanups based on Quantified code
2 parents 448d9ed + 3cb7787 commit 4e725b8

File tree

11 files changed

+17
-40
lines changed

11 files changed

+17
-40
lines changed

doc/pyplots/whats_new_98_4_legend.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import matplotlib.pyplot as plt
22
import numpy as np
3-
import matplotlib.pyplot as plt
43

54

65
ax = plt.subplot(111)
@@ -13,6 +12,3 @@
1312

1413

1514
plt.show()
16-
17-
18-

examples/lines_bars_and_markers/barh_demo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
Simple demo of a horizontal bar chart.
33
"""
44
import matplotlib.pyplot as plt
5-
plt.rcdefaults()
65
import numpy as np
7-
import matplotlib.pyplot as plt
86

97

8+
plt.rcdefaults()
9+
1010
# Example data
1111
people = ('Tom', 'Dick', 'Harry', 'Slim', 'Jim')
1212
y_pos = np.arange(len(people))

examples/shapes_and_collections/artist_reference.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
BSD License
1010
"""
1111
import matplotlib.pyplot as plt
12-
plt.rcdefaults()
13-
1412
import numpy as np
15-
import matplotlib.pyplot as plt
1613
import matplotlib.path as mpath
1714
import matplotlib.lines as mlines
1815
import matplotlib.patches as mpatches
1916
from matplotlib.collections import PatchCollection
2017

2118

19+
plt.rcdefaults()
20+
21+
2222
def label(xy, text):
2323
y = xy[1] - 0.15 # shift y-value for label so that it's below the artist
2424
plt.text(xy[0], y, text, ha="center", family='sans-serif', size=14)

lib/matplotlib/_mathtext_data.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,6 @@
348348
r'\Rightarrow' : ('psyr', 222),
349349
r'\Downarrow' : ('psyr', 223),
350350
r'\Diamond' : ('psyr', 224),
351-
r'\langle' : ('psyr', 225),
352351
r'\Sigma' : ('psyr', 229),
353352
r'\sum' : ('psyr', 229),
354353
r'\forall' : ('psyr', 34),
@@ -2111,7 +2110,6 @@
21112110
'pitchfork' : 8916,
21122111
'blacktriangleleft' : 9664,
21132112
'nprec' : 8832,
2114-
'vdots' : 8942,
21152113
'curvearrowright' : 8631,
21162114
'barwedge' : 8892,
21172115
'multimap' : 8888,
@@ -2138,7 +2136,6 @@
21382136
'Im' : 8465,
21392137
'curvearrowleft' : 8630,
21402138
'wedgeq' : 8793,
2141-
'fallingdotseq' : 8786,
21422139
'curlyeqprec' : 8926,
21432140
'questeq' : 8799,
21442141
'less' : 60,

lib/matplotlib/artist.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,14 +1363,6 @@ def pprint_setters_rest(self, prop=None, leadingspace=2):
13631363
lines.append(table_formatstr)
13641364
lines.append('')
13651365
return lines
1366-
########
1367-
1368-
for prop, path in attrs:
1369-
accepts = self.get_valid_values(prop)
1370-
name = self.aliased_name_rest(prop, path)
1371-
1372-
lines.append('%s%s: %s' % (pad, name, accepts))
1373-
return lines
13741366

13751367
def properties(self):
13761368
"""

lib/matplotlib/backends/backend_gtkagg.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ def new_figure_manager_given_figure(num, figure):
5151
Create a new figure manager instance for the given figure.
5252
"""
5353
canvas = FigureCanvasGTKAgg(figure)
54-
return FigureManagerGTKAgg(canvas, num)
54+
figuremanager = FigureManagerGTKAgg(canvas, num)
5555
if DEBUG: print('backend_gtkagg.new_figure_manager done')
56+
return figuremanager
5657

5758

5859
class FigureCanvasGTKAgg(FigureCanvasGTK, FigureCanvasAgg):

lib/matplotlib/rcsetup.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,12 +1065,10 @@ def validate_animation_writer_path(p):
10651065
# the number of points in the legend line for scatter
10661066
'legend.scatterpoints': [3, validate_int],
10671067
'legend.fontsize': ['large', validate_fontsize],
1068-
# the relative size of legend markers vs. original
1069-
'legend.markerscale': [1.0, validate_float],
1070-
'legend.shadow': [False, validate_bool],
1071-
# whether or not to draw a frame around legend
1068+
1069+
# whether or not to draw a frame around legend
10721070
'legend.frameon': [True, validate_bool],
1073-
# alpha value of the legend frame
1071+
# alpha value of the legend frame
10741072
'legend.framealpha': [None, validate_float_or_None],
10751073

10761074
## the following dimensions are in fraction of the font size

lib/matplotlib/testing/jpl_units/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@
4040
from .Epoch import Epoch
4141
from .UnitDbl import UnitDbl
4242

43-
from .Duration import Duration
44-
from .Epoch import Epoch
45-
from .UnitDbl import UnitDbl
46-
4743
from .StrConverter import StrConverter
4844
from .EpochConverter import EpochConverter
4945
from .UnitDblConverter import UnitDblConverter

lib/matplotlib/tests/test_axes.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import matplotlib.pyplot as plt
2626
import matplotlib.markers as mmarkers
2727
from numpy.testing import assert_allclose, assert_array_equal
28-
import warnings
2928
from matplotlib.cbook import IgnoredKeywordWarning
3029

3130
import sys

lib/matplotlib/tests/test_simplification.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
from matplotlib.testing.decorators import image_comparison, knownfailureif, cleanup
99
import matplotlib.pyplot as plt
1010

11-
from pylab import *
12-
import numpy as np
1311
from matplotlib import patches, path, transforms
1412

1513
from nose.tools import raises
@@ -24,7 +22,7 @@
2422
@image_comparison(baseline_images=['clipping'], remove_text=True)
2523
def test_clipping():
2624
t = np.arange(0.0, 2.0, 0.01)
27-
s = np.sin(2*pi*t)
25+
s = np.sin(2*np.pi*t)
2826

2927
fig = plt.figure()
3028
ax = fig.add_subplot(111)
@@ -101,16 +99,16 @@ def test_simplify_curve():
10199
def test_hatch():
102100
fig = plt.figure()
103101
ax = fig.add_subplot(111)
104-
ax.add_patch(Rectangle((0, 0), 1, 1, fill=False, hatch="/"))
102+
ax.add_patch(plt.Rectangle((0, 0), 1, 1, fill=False, hatch="/"))
105103
ax.set_xlim((0.45, 0.55))
106104
ax.set_ylim((0.45, 0.55))
107105

108106
@image_comparison(baseline_images=['fft_peaks'], remove_text=True)
109107
def test_fft_peaks():
110108
fig = plt.figure()
111-
t = arange(65536)
109+
t = np.arange(65536)
112110
ax = fig.add_subplot(111)
113-
p1 = ax.plot(abs(fft(sin(2*pi*.01*t)*blackman(len(t)))))
111+
p1 = ax.plot(abs(np.fft.fft(np.sin(2*np.pi*.01*t)*np.blackman(len(t)))))
114112

115113
path = p1[0].get_path()
116114
transform = p1[0].get_transform()
@@ -163,7 +161,7 @@ def test_start_with_moveto():
163161
@cleanup
164162
@raises(OverflowError)
165163
def test_throw_rendering_complexity_exceeded():
166-
rcParams['path.simplify'] = False
164+
plt.rcParams['path.simplify'] = False
167165
xx = np.arange(200000)
168166
yy = np.random.rand(200000)
169167
yy[1000] = np.nan
@@ -173,7 +171,7 @@ def test_throw_rendering_complexity_exceeded():
173171
try:
174172
fig.savefig(io.BytesIO())
175173
finally:
176-
rcParams['path.simplify'] = True
174+
plt.rcParams['path.simplify'] = True
177175

178176
@image_comparison(baseline_images=['clipper_edge'], remove_text=True)
179177
def test_clipper():

lib/mpl_toolkits/axisartist/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from matplotlib.externals import six
55

66
from .axislines import Axes, Subplot, AxesZero, SubplotZero, GridHelperRectlinear, \
7-
AxisArtistHelperRectlinear, AxisArtistHelper, GridHelperBase, AxisArtist
7+
AxisArtistHelperRectlinear, AxisArtistHelper, GridHelperBase
88
from .axis_artist import AxisArtist, GridlinesCollection
99

1010
from .grid_helper_curvelinear import GridHelperCurveLinear

0 commit comments

Comments
 (0)