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 1f0c801

Browse filesBrowse files
committed
Fix #570 - Reversing a 3d axis should now work properly.
1 parent 615a30a commit 1f0c801
Copy full SHA for 1f0c801

File tree

Expand file treeCollapse file tree

1 file changed

+14
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+14
-3
lines changed

‎lib/mpl_toolkits/mplot3d/axis3d.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/mplot3d/axis3d.py
+14-3Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,12 @@ def get_rotate_label(self, text):
161161

162162
def _get_coord_info(self, renderer):
163163
minx, maxx, miny, maxy, minz, maxz = self.axes.get_w_lims()
164+
if minx > maxx:
165+
minx, maxx = maxx, minx
166+
if miny > maxy:
167+
miny, maxy = maxy, miny
168+
if minz > maxz:
169+
minz, maxz = maxz, minz
164170
mins = np.array((minx, miny, minz))
165171
maxs = np.array((maxx, maxy, maxz))
166172
centers = (maxs + mins) / 2.
@@ -205,13 +211,18 @@ def draw(self, renderer):
205211
index = info['i']
206212

207213
# filter locations here so that no extra grid lines are drawn
208-
interval = self.get_view_interval()
209-
majorLocs = [loc for loc in majorLocs if \
210-
interval[0] <= loc <= interval[1]]
214+
locmin, locmax = self.get_view_interval()
215+
if locmin > locmax:
216+
locmin, locmax = locmax, locmin
217+
218+
# Rudimentary clipping
219+
majorLocs = [loc for loc in majorLocs if
220+
locmin <= loc <= locmax]
211221
self.major.formatter.set_locs(majorLocs)
212222
majorLabels = [self.major.formatter(val, i)
213223
for i, val in enumerate(majorLocs)]
214224

225+
215226
mins, maxs, centers, deltas, tc, highs = self._get_coord_info(renderer)
216227

217228
# Determine grid lines

0 commit comments

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