8000 ENH: set non-used ticks to not visible · matplotlib/matplotlib@e908efe · GitHub
[go: up one dir, main page]

Skip to content

Commit e908efe

Browse files
committed
ENH: set non-used ticks to not visible
This is to prevent user confusion if they are reaching directly into `Axis.minorTicks` and `Axis.majorTicks` and see ticks report they are visible but are not actually drawn.
1 parent 24de3e9 commit e908efe

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/matplotlib/axis.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,11 @@ def _update_ticks(self):
10951095
tick.set_label2(label)
10961096
ticks = [*major_ticks, *minor_ticks]
10971097

1098+
# mark the ticks that we will not be using as not visible
1099+
for t in (self.minorTicks[len(minor_locs):] +
1100+
self.majorTicks[len(major_locs):]):
1101+
t.set_visible(False)
1102+
10981103
view_low, view_high = self.get_view_interval()
10991104
if view_low > view_high:
11001105
view_low, view_high = view_high, view_low

0 commit comments

Comments
 (0)
0