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

Skip to content

Commit 8508247

Browse files
committed
Kill some commented-out code.
- polar.py: commented out since 2008. - textpath.py: `oldfont` appears nowhere else in the file. - tight_layout.py: auto_adjust_subplotpars takes care of defaulting `{h,v}_pad` to `pad` if they are None. - offsetbox.py: `self._f{w,h}` appears no where else. - clip_path.py: the lines are basically duplicated (with proper if conditions) just above.
1 parent 2660901 commit 8508247

File tree

7 files changed

+19
-140
lines changed

7 files changed

+19
-140
lines changed

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ per-file-ignores =
5454
mpl_toolkits/axes_grid1/colorbar.py: E225, E501
5555
mpl_toolkits/axes_grid1/inset_locator.py: E501
5656
mpl_toolkits/axisartist/angle_helper.py: E221
57-
mpl_toolkits/axisartist/clip_path.py: E225, E501
57+
mpl_toolkits/axisartist/clip_path.py: E225
5858
mpl_toolkits/axisartist/floating_axes.py: E225, E402, E501
5959
mpl_toolkits/axisartist/grid_helper_curvelinear.py: E225, E501
6060
mpl_toolkits/tests/test_axes_grid1.py: E201, E202

lib/matplotlib/contour.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -829,9 +829,8 @@ def __init__(self, ax, *args,
829829
if self.antialiased is None and self.filled:
830830
self.antialiased = False # eliminate artifacts; we are not
831831
# stroking the boundaries.
832-
# The default for line contours will be taken from
833-
# the LineCollection default, which uses the
834-
# rcParams['lines.antialiased']
832+
# The default for line contours will be taken from the
833+
# LineCollection default, which uses :rc:`lines.antialiased`.
835834

836835
self.nchunk = kwargs.pop('nchunk', 0)
837836
self.locator = kwargs.pop('locator', None)

lib/matplotlib/offsetbox.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1425,7 +1425,6 @@ def __init__(self, offsetbox, xy,
14251425
self._arrow_relpos = None
14261426
self.arrow_patch = None
14271427

1428-
#self._fw, self._fh = 0., 0. # for alignment
14291428
self._box_alignment = box_alignment
14301429

14311430
# frame

lib/matplotlib/projections/polar.py

Lines changed: 0 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -1478,121 +1478,3 @@ def drag_pan(self, button, key, x, y):
14781478
PolarAxes.ThetaFormatter = ThetaFormatter
14791479
PolarAxes.RadialLocator = RadialLocator
14801480
PolarAxes.ThetaLocator = ThetaLocator
1481-
1482-
1483-
# These are a couple of aborted attempts to project a polar plot using
1484-
# cubic bezier curves.
1485-
1486-
# def transform_path(self, path):
1487-
# twopi = 2.0 * np.pi
1488-
# halfpi = 0.5 * np.pi
1489-
1490-
# vertices = path.vertices
1491-
# t0 = vertices[0:-1, 0]
1492-
# t1 = vertices[1: , 0]
1493-
# td = np.where(t1 > t0, t1 - t0, twopi - (t0 - t1))
1494-
# maxtd = td.max()
1495-
# interpolate = np.ceil(maxtd / halfpi)
1496-
# if interpolate > 1.0:
1497-
# vertices = self.interpolate(vertices, interpolate)
1498-
1499-
# vertices = self.transform(vertices)
1500-
1501-
# result = np.zeros((len(vertices) * 3 - 2, 2), float)
1502-
# codes = mpath.Path.CURVE4 * np.ones((len(vertices) * 3 - 2, ),
1503-
# mpath.Path.code_type)
1504-
# result[0] = vertices[0]
1505-
# codes[0] = mpath.Path.MOVETO
1506-
1507-
# kappa = 4.0 * ((np.sqrt(2.0) - 1.0) / 3.0)
1508-
# kappa = 0.5
1509-
1510-
# p0 = vertices[0:-1]
1511-
# p1 = vertices[1: ]
1512-
1513-
# x0 = p0[:, 0:1]
1514-
# y0 = p0[:, 1: ]
1515-
# b0 = ((y0 - x0) - y0) / ((x0 + y0) - x0)
1516-
# a0 = y0 - b0*x0
1517-
1518-
# x1 = p1[:, 0:1]
1519-
# y1 = p1[:, 1: ]
1520-
# b1 = ((y1 - x1) - y1) / ((x1 + y1) - x1)
1521-
# a1 = y1 - b1*x1
1522-
1523-
# x = -(a0-a1) / (b0-b1)
1524-
# y = a0 + b0*x
1525-
1526-
# xk = (x - x0) * kappa + x0
1527-
# yk = (y - y0) * kappa + y0
1528-
1529-
# result[1::3, 0:1] = xk
1530-
# result[1::3, 1: ] = yk
1531-
1532-
# xk = (x - x1) * kappa + x1
1533-
# yk = (y - y1) * kappa + y1
1534-
1535-
# result[2::3, 0:1] = xk
1536-
# result[2::3, 1: ] = yk
1537-
1538-
# result[3::3] = p1
1539-
1540-
# print(vertices[-2:])
1541-
# print(result[-2:])
1542-
1543-
# return mpath.Path(result, codes)
1544-
1545-
# twopi = 2.0 * np.pi
1546-
# halfpi = 0.5 * np.pi
1547-
1548-
# vertices = path.vertices
1549-
# t0 = vertices[0:-1, 0]
1550-
# t1 = vertices[1: , 0]
1551-
# td = np.where(t1 > t0, t1 - t0, twopi - (t0 - t1))
1552-
# maxtd = td.max()
1553-
# interpolate = np.ceil(maxtd / halfpi)
1554-
1555-
# print("interpolate", interpolate)
1556-
# if interpolate > 1.0:
1557-
# vertices = self.interpolate(vertices, interpolate)
1558-
1559-
# result = np.zeros((len(vertices) * 3 - 2, 2), float)
1560-
# codes = mpath.Path.CURVE4 * np.ones((len(vertices) * 3 - 2, ),
1561-
# mpath.Path.code_type)
1562-
# result[0] = vertices[0]
1563-
# codes[0] = mpath.Path.MOVETO
1564-
1565-
# kappa = 4.0 * ((np.sqrt(2.0) - 1.0) / 3.0)
1566-
# tkappa = np.arctan(kappa)
1567-
# hyp_kappa = np.sqrt(kappa*kappa + 1.0)
1568-
1569-
# t0 = vertices[0:-1, 0]
1570-
# t1 = vertices[1: , 0]
1571-
# r0 = vertices[0:-1, 1]
1572-
# r1 = vertices[1: , 1]
1573-
1574-
# td = np.where(t1 > t0, t1 - t0, twopi - (t0 - t1))
1575-
# td_scaled = td / (np.pi * 0.5)
1576-
# rd = r1 - r0
1577-
# r0kappa = r0 * kappa * td_scaled
1578-
# r1kappa = r1 * kappa * td_scaled
1579-
# ravg_kappa = ((r1 + r0) / 2.0) * kappa * td_scaled
1580-
1581-
# result[1::3, 0] = t0 + (tkappa * td_scaled)
1582-
# result[1::3, 1] = r0*hyp_kappa
1583-
# # result[1::3, 1] = r0 / np.cos(tkappa * td_scaled)
1584-
# # np.sqrt(r0*r0 + ravg_kappa*ravg_kappa)
1585-
1586-
# result[2::3, 0] = t1 - (tkappa * td_scaled)
1587-
# result[2::3, 1] = r1*hyp_kappa
1588-
# # result[2::3, 1] = r1 / np.cos(tkappa * td_scaled)
1589-
# # np.sqrt(r1*r1 + ravg_kappa*ravg_kappa)
1590-
1591-
# result[3::3, 0] = t1
1592-
# result[3::3, 1] = r1
1593-
1594-
# print(vertices[:6], result[:6], t0[:6], t1[:6], td[:6],
1595-
# td_scaled[:6], tkappa)
1596-
# result = self.transform(result)
1597-
# return mpath.Path(result, codes)
1598-
# transform_path_non_affine = transform_path

lib/matplotlib/textpath.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,6 @@ def get_glyphs_tex(self, prop, s, glyph_map=None,
315315

316316
# Gather font information and do some setup for combining
317317
# characters into strings.
318-
# oldfont, seq = None, []
319318
for x1, y1, dvifont, glyph, width in page.text:
320319
font, enc = self._get_ps_font_and_encoding(dvifont.texname)
321320
char_id = self._get_char_id_ps(font, glyph)

lib/matplotlib/tight_layout.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,9 +380,6 @@ def get_tight_layout_figure(fig, axes_list, subplotspec_list, renderer,
380380
if top is not None:
381381
top -= (1 - kwargs["top"])
382382

383-
#if h_pad is None: h_pad = pad
384-
#if w_pad is None: w_pad = pad
385-
386383
kwargs = auto_adjust_subplotpars(fig, renderer,
387384
nrows_ncols=(max_nrows, max_ncols),
388385
num1num2_list=num1num2_list,

lib/mpl_toolkits/axisartist/clip_path.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -85,23 +85,26 @@ def clip_line_to_rect(xline, yline, bbox):
8585
ydir = y1 > y0
8686

8787
if x1 > x0:
88-
lx1, ly1, c_right_ = clip([xline], [yline], x1, clip="right", xdir=xdir, ydir=ydir)
89-
lx2, ly2, c_left_ = clip(lx1, ly1, x0, clip="left", xdir=xdir, ydir=ydir)
88+
lx1, ly1, c_right_ = clip([xline], [yline], x1,
89+
clip="right", xdir=xdir, ydir=ydir)
90+
lx2, ly2, c_left_ = clip(lx1, ly1, x0,
91+
clip="left", xdir=xdir, ydir=ydir)
9092
else:
91-
lx1, ly1, c_right_ = clip([xline], [yline], x0, clip="right", xdir=xdir, ydir=ydir)
92-
lx2, ly2, c_left_ = clip(lx1, ly1, x1, clip="left", xdir=xdir, ydir=ydir)
93+
lx1, ly1, c_right_ = clip([xline], [yline], x0,
94+
clip="right", xdir=xdir, ydir=ydir)
95+
lx2, ly2, c_left_ = clip(lx1, ly1, x1,
96+
clip="left", xdir=xdir, ydir=ydir)
9397

9498
if y1 > y0:
95-
ly3, lx3, c_top_ = clip(ly2, lx2, y1, clip="right", xdir=ydir, ydir=xdir)
96-
ly4, lx4, c_bottom_ = clip(ly3, lx3, y0, clip="left", xdir=ydir, ydir=xdir)
99+
ly3, lx3, c_top_ = clip(ly2, lx2, y1,
100+
clip="right", xdir=ydir, ydir=xdir)
101+
ly4, lx4, c_bottom_ = clip(ly3, lx3, y0,
102+
clip="left", xdir=ydir, ydir=xdir)
97103
else:
98-
ly3, lx3, c_top_ = clip(ly2, lx2, y0, clip="right", xdir=ydir, ydir=xdir)
99-
ly4, lx4, c_bottom_ = clip(ly3, lx3, y1, clip="left", xdir=ydir, ydir=xdir)
100-
101-
# lx1, ly1, c_right_ = clip([xline], [yline], x1, clip="right")
102-
# lx2, ly2, c_left_ = clip(lx1, ly1, x0, clip="left")
103-
# ly3, lx3, c_top_ = clip(ly2, lx2, y1, clip="right")
104-
# ly4, lx4, c_bottom_ = clip(ly3, lx3, y0, clip="left")
104+
ly3, lx3, c_top_ = clip(ly2, lx2, y0,
105+
clip="right", xdir=ydir, ydir=xdir)
106+
ly4, lx4, c_bottom_ = clip(ly3, lx3, y1,
107+
clip="left", xdir=ydir, ydir=xdir)
105108

106109
c_left = [((x, y), (a + 90) % 180 - 90) for x, y, a in c_left_
107110
if bbox.containsy(y)]

0 commit comments

Comments
 (0)