Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0c96f77

Browse filesBrowse files
committed
Remove duplicated methods in FixedAxisArtistHelper.
These are copy-pasted from the same methods in the parent class FloatingAxisArtistHelper. Also cleanup a bit the base method implementation.
1 parent 9faf231 commit 0c96f77
Copy full SHA for 0c96f77

File tree

Expand file treeCollapse file tree

2 files changed

+12
-45
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+12
-45
lines changed

‎lib/mpl_toolkits/axisartist/floating_axes.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/axisartist/floating_axes.py
-34Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -40,37 +40,6 @@ def update_lim(self, axes):
4040
self.grid_helper.update_lim(axes)
4141
self.grid_info = self.grid_helper.grid_info
4242

43-
def get_axislabel_pos_angle(self, axes):
44-
45-
extremes = self.grid_info["extremes"]
46-
47-
if self.nth_coord == 0:
48-
xx0 = self.value
49-
yy0 = (extremes[2]+extremes[3])/2.
50-
dxx, dyy = 0., abs(extremes[2]-extremes[3])/1000.
51-
elif self.nth_coord == 1:
52-
xx0 = (extremes[0]+extremes[1])/2.
53-
yy0 = self.value
54-
dxx, dyy = abs(extremes[0]-extremes[1])/1000., 0.
55-
56-
grid_finder = self.grid_helper.grid_finder
57-
xx1, yy1 = grid_finder.transform_xy([xx0], [yy0])
58-
59-
trans_passingthrough_point = axes.transData + axes.transAxes.inverted()
60-
p = trans_passingthrough_point.transform_point([xx1[0], yy1[0]])
61-
62-
if 0 <= p[0] <= 1 and 0 <= p[1] <= 1:
63-
xx1c, yy1c = axes.transData.transform_point([xx1[0], yy1[0]])
64-
xx2, yy2 = grid_finder.transform_xy([xx0+dxx], [yy0+dyy])
65-
xx2c, yy2c = axes.transData.transform_point([xx2[0], yy2[0]])
66-
67-
return (xx1c, yy1c), np.arctan2(yy2c-yy1c, xx2c-xx1c)/np.pi*180.
68-
else:
69-
return None, None
70-
71-
def get_tick_transform(self, axes):
72-
return IdentityTransform() # axes.transData
73-
7443
def get_tick_iterators(self, axes):
7544
"""tick_loc, tick_angle, tick_label, (optionally) tick_label"""
7645

@@ -164,9 +133,6 @@ def f1():
164133

165134
return f1(), iter([])
166135

167-
def get_line_transform(self, axes):
168-
return axes.transData
169-
170136
def get_line(self, axes):
171137

172138
self.update_lim(axes)

‎lib/mpl_toolkits/axisartist/grid_helper_curvelinear.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/axisartist/grid_helper_curvelinear.py
+12-11Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -157,25 +157,26 @@ def get_axislabel_pos_angle(self, axes):
157157

158158
if self.nth_coord == 0:
159159
xx0 = self.value
160-
yy0 = (extremes[2]+extremes[3])/2.
161-
dxx, dyy = 0., abs(extremes[2]-extremes[3])/1000.
160+
yy0 = (extremes[2] + extremes[3]) / 2
161+
dxx = 0
162+
dyy = abs(extremes[2] - extremes[3]) / 1000
162163
elif self.nth_coord == 1:
163-
xx0 = (extremes[0]+extremes[1])/2.
164+
xx0 = (extremes[0] + extremes[1]) / 2
164165
yy0 = self.value
165-
dxx, dyy = abs(extremes[0]-extremes[1])/1000., 0.
166+
dxx = abs(extremes[0] - extremes[1]) / 1000
167+
dyy = 0
166168

167169
grid_finder = self.grid_helper.grid_finder
168-
xx1, yy1 = grid_finder.transform_xy([xx0], [yy0])
170+
(xx1,), (yy1,) = grid_finder.transform_xy([xx0], [yy0])
169171

170172
trans_passingthrough_point = axes.transData + axes.transAxes.inverted()
171-
p = trans_passingthrough_point.transform_point([xx1[0], yy1[0]])
173+
p = trans_passingthrough_point.transform_point([xx1, yy1])
172174

173175
if 0 <= p[0] <= 1 and 0 <= p[1] <= 1:
174-
xx1c, yy1c = axes.transData.transform_point([xx1[0], yy1[0]])
175-
xx2, yy2 = grid_finder.transform_xy([xx0+dxx], [yy0+dyy])
176-
xx2c, yy2c = axes.transData.transform_point([xx2[0], yy2[0]])
177-
178-
return (xx1c, yy1c), np.arctan2(yy2c-yy1c, xx2c-xx1c)/np.pi*180.
176+
xx1c, yy1c = axes.transData.transform_point([xx1, yy1])
177+
(xx2,), (yy2,) = grid_finder.transform_xy([xx0 + dxx], [yy0 + dyy])
178+
xx2c, yy2c = axes.transData.transform_point([xx2, yy2])
179+
return (xx1c, yy1c), np.rad2deg(np.arctan2(yy2c-yy1c, xx2c-xx1c))
179180
else:
180181
return None, None
181182

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.