@@ -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