|
24 | 24 | # The sole purpose of this class is to look at the upper, lower, or total
|
25 | 25 | # interval as appropriate and see what parts of the tick to draw, if any.
|
26 | 26 | class SkewXTick(maxis.XTick):
|
| 27 | + def update_position(self, loc): |
| 28 | + # This ensures that the new value of the location is set before |
| 29 | + # any other updates take place |
| 30 | + self._loc = loc |
| 31 | + super(SkewXTick, self).update_position(loc) |
| 32 | + |
| 33 | + def _has_default_loc(self): |
| 34 | + return self.get_loc() is None |
| 35 | + |
27 | 36 | def _need_lower(self):
|
28 |
| - return transforms.interval_contains(self.axes.lower_xlim, |
29 |
| - self.get_loc()) |
| 37 | + return (self._has_default_loc() or |
| 38 | + transforms.interval_contains(self.axes.lower_xlim, |
| 39 | + self.get_loc())) |
30 | 40 |
|
31 | 41 | def _need_upper(self):
|
32 |
| - return transforms.interval_contains(self.axes.upper_xlim, |
33 |
| - self.get_loc()) |
| 42 | + return (self._has_default_loc() or |
| 43 | + transforms.interval_contains(self.axes.upper_xlim, |
| 44 | + self.get_loc())) |
34 | 45 |
|
35 | 46 | @property
|
36 | 47 | def gridOn(self):
|
37 |
| - return (self._gridOn and |
| 48 | + return (self._gridOn and (self._has_default_loc() or |
38 | 49 | transforms.interval_contains(self.get_view_interval(),
|
39 |
| - self.get_loc())) |
| 50 | + self.get_loc()))) |
40 | 51 |
|
41 | 52 | @gridOn.setter
|
42 | 53 | def gridOn(self, value):
|
@@ -82,7 +93,7 @@ def get_view_interval(self):
|
82 | 93 | # as well as create instances of the custom tick
|
83 | 94 | class SkewXAxis(maxis.XAxis):
|
84 | 95 | def _get_tick(self, major):
|
85 |
| - return SkewXTick(self.axes, 0, '', major=major) |
| 96 | + return SkewXTick(self.axes, None, '', major=major) |
86 | 97 |
|
87 | 98 | def get_view_interval(self):
|
88 | 99 | return self.axes.upper_xlim[0], self.axes.lower_xlim[1]
|
|
0 commit comments