8000 Remove duplicated methods in FixedAxisArtistHelper. by anntzer · Pull Request #13737 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Remove duplicated methods in FixedAxisArtistHelper. #13737

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions lib/mpl_toolkits/axisartist/floating_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,37 +40,6 @@ def update_lim(self, axes):
self.grid_helper.update_lim(axes)
self.grid_info = self.grid_helper.grid_info

def get_axislabel_pos_angle(self, axes):

extremes = self.grid_info["extremes"]

if self.nth_coord == 0:
xx0 = self.value
yy0 = (extremes[2]+extremes[3])/2.
dxx, dyy = 0., abs(extremes[2]-extremes[3])/1000.
elif self.nth_coord == 1:
xx0 = (extremes[0]+extremes[1])/2.
yy0 = self.value
dxx, dyy = abs(extremes[0]-extremes[1])/1000., 0.

grid_finder = self.grid_helper.grid_finder
xx1, yy1 = grid_finder.transform_xy([xx0], [yy0])

trans_passingthrough_point = axes.transData + axes.transAxes.inverted()
p = trans_passingthrough_point.transform_point([xx1[0], yy1[0]])

if 0 <= p[0] <= 1 and 0 <= p[1] <= 1:
xx1c, yy1c = axes.transData.transform_point([xx1[0], yy1[0]])
xx2, yy2 = grid_finder.transform_xy([xx0+dxx], [yy0+dyy])
xx2c, yy2c = axes.transData.transform_point([xx2[0], yy2[0]])

return (xx1c, yy1c), np.arctan2(yy2c-yy1c, xx2c-xx1c)/np.pi*180.
else:
return None, None

def get_tick_transform(self, axes):
return IdentityTransform() # axes.transData

def get_tick_iterators(self, axes):
"""tick_loc, tick_angle, tick_label, (optionally) tick_label"""

Expand Down Expand Up @@ -164,9 +133,6 @@ def f1():

return f1(), iter([])

def get_line_transform(self, axes):
return axes.transData

def get_line(self, axes):

self.update_lim(axes)
Expand Down
23 changes: 12 additions & 11 deletions lib/mpl_toolkits/axisartist/grid_helper_curvelinear.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,25 +157,26 @@ def get_axislabel_pos_angle(self, axes):

if self.nth_coord == 0:
xx0 = self.value
yy0 = (extremes[2]+extremes[3])/2.
dxx, dyy = 0., abs(extremes[2]-extremes[3])/1000.
yy0 = (extremes[2] + extremes[3]) / 2
dxx = 0
dyy = abs(extremes[2] - extremes[3]) / 1000
elif self.nth_coord == 1:
xx0 = (extremes[0]+extremes[1])/2.
xx0 = (extremes[0] + extremes[1]) / 2
yy0 = self.value
dxx, dyy = abs(extremes[0]-extremes[1])/1000., 0.
dxx = abs(extremes[0] - extremes[1]) / 1000
dyy = 0

grid_finder = self.grid_helper.grid_finder
xx1, yy1 = grid_finder.transform_xy([xx0], [yy0])
(xx1,), (yy1,) = grid_finder.transform_xy([xx0], [yy0])

trans_passingthrough_point = axes.transData + axes.transAxes.inverted()
p = trans_passingthrough_point.transform_point([xx1[0], yy1[0]])
p = trans_passingthrough_point.transform_point([xx1, yy1])

if 0 <= p[0] <= 1 and 0 <= p[1] <= 1:
xx1c, yy1c = axes.transData.transform_point([xx1[0], yy1[0]])
xx2, yy2 = grid_finder.transform_xy([xx0+dxx], [yy0+dyy])
xx2c, yy2c = axes.transData.transform_point([xx2[0], yy2[0]])

return (xx1c, yy1c), np.arctan2(yy2c-yy1c, xx2c-xx1c)/np.pi*180.
xx1c, yy1c = axes.transData.transform_point([xx1, yy1])
(xx2,), (yy2,) = grid_finder.transform_xy([xx0 + dxx], [yy0 + dyy])
xx2c, yy2c = axes.transData.transform_point([xx2, yy2])
return (xx1c, yy1c), np.rad2deg(np.arctan2(yy2c-yy1c, xx2c-xx1c))
else:
return None, None

Expand Down
0