Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 674ebf2

Browse files
committed
Reduce the floating point slop allowance in selecting ticks to show.
In #1686 this was set to half a pixel, but I don't think this makes sense, and it is not needed in order to pass the test that was added to check for lost ticks (#1310), or for the cases in #1310.
1 parent d213621 commit 674ebf2

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/matplotlib/axis.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,9 +1049,7 @@ def _update_ticks(self, renderer):
10491049
tick_tups = [ti for ti in tick_tups if ilow <= ti[1] <= ihigh]
10501050

10511051
# so that we don't lose ticks on the end, expand out the interval ever
1052-
# so slightly. The "ever so slightly" is defined to be the width of a
1053-
# half of a pixel. We don't want to draw a tick that even one pixel
1054-
# outside of the defined axis interval.
1052+
# so slightly to compensate for floating point slop.
10551053
if interval[0] <= interval[1]:
10561054
interval_expanded = interval
10571055
else:
@@ -1072,7 +1070,7 @@ def _update_ticks(self, renderer):
10721070
with np.errstate(invalid='ignore'):
10731071
try:
10741072
ds1 = self._get_pixel_distance_along_axis(
1075-
interval_expanded[0], -0.5)
1073+
interval_expanded[0], -0.0005)
10761074
except:
10771075
warnings.warn("Unable to find pixel distance along axis "
10781076
"for interval padding of ticks; assuming no "
@@ -1082,7 +1080,7 @@ def _update_ticks(self, renderer):
10821080
ds1 = 0.0
10831081
try:
10841082
ds2 = self._get_pixel_distance_along_axis(
1085-
interval_expanded[1], +0.5)
1083+
interval_expanded[1], +0.0005)
10861084
except:
10871085
warnings.warn("Unable to find pixel distance along axis "
10881086
"for interval padding of ticks; assuming no "

0 commit comments

Comments
 (0)