Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix #570 - Reversing a 3d axis should now work properly. #1653

Merged
merged 1 commit into from

3 participants

@WeatherGod
Collaborator

Just needed to check for flipped limits in certain places.

@NelleV NelleV commented on the diff
lib/mpl_toolkits/mplot3d/axis3d.py
((14 lines not shown))
self.major.formatter.set_locs(majorLocs)
majorLabels = [self.major.formatter(val, i)
for i, val in enumerate(majorLocs)]
+
@NelleV Collaborator
NelleV added a note

PEP8 compliance: there should be only one blank line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@dmcdougall dmcdougall merged commit 1f0c801 into from
@dmcdougall
Collaborator

I fixed the PEP8 issue and merged it locally. Check out 894e8cf.

@WeatherGod
Collaborator

Thanks for that. I have been busy with other things at work.

@dmcdougall
Collaborator

No problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 14 additions and 3 deletions.
  1. +14 −3 lib/mpl_toolkits/mplot3d/axis3d.py
View
17 lib/mpl_toolkits/mplot3d/axis3d.py
@@ -161,6 +161,12 @@ def get_rotate_label(self, text):
def _get_coord_info(self, renderer):
minx, maxx, miny, maxy, minz, maxz = self.axes.get_w_lims()
+ if minx > maxx:
+ minx, maxx = maxx, minx
+ if miny > maxy:
+ miny, maxy = maxy, miny
+ if minz > maxz:
+ minz, maxz = maxz, minz
mins = np.array((minx, miny, minz))
maxs = np.array((maxx, maxy, maxz))
centers = (maxs + mins) / 2.
@@ -205,13 +211,18 @@ def draw(self, renderer):
index = info['i']
# filter locations here so that no extra grid lines are drawn
- interval = self.get_view_interval()
- majorLocs = [loc for loc in majorLocs if \
- interval[0] <= loc <= interval[1]]
+ locmin, locmax = self.get_view_interval()
+ if locmin > locmax:
+ locmin, locmax = locmax, locmin
+
+ # Rudimentary clipping
+ majorLocs = [loc for loc in majorLocs if
+ locmin <= loc <= locmax]
self.major.formatter.set_locs(majorLocs)
majorLabels = [self.major.formatter(val, i)
for i, val in enumerate(majorLocs)]
+
@NelleV Collaborator
NelleV added a note

PEP8 compliance: there should be only one blank line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
mins, maxs, centers, deltas, tc, highs = self._get_coord_info(renderer)
# Determine grid lines
Something went wrong with that request. Please try again.