Skip to content

Commit c60a406

Browse files
committed
add comments to ticks.jl: on FixedLocator and on steps
1 parent 9b79697 commit c60a406

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/ticks.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ function _set_ticks(ax, axtypes, minorticks, ticklabels)
2929
axis.set_major_locator(mpl.ticker.MaxNLocator(nbins = 7, steps = [1, 2, 5, 10]))
3030
# `nbins` should probably depend on figure size, i.e. how large texts are wrt
3131
# other graphical elements.
32+
# For `steps` we omit 2.5.
3233
if minorticks
3334
axis.set_minor_locator(mpl.ticker.AutoMinorLocator())
3435
else
@@ -66,5 +67,9 @@ function _set_ticks(ax, axtypes, minorticks, ticklabels)
6667
# Goal: labels stay visible when overlapping with elements of an adjactent Axes.
6768

6869
axis.set_ticks(ticklocs, ticklabels; bbox)
70+
# Note that this changes the tick locator to a FixedLocator. As a result, changing
71+
# the lims (e.g. zooming in) after this, you won't get useful ticks. (Cannot replace
72+
# by just `axis.set_ticklabels` either: then labels get out of sync with ticks)
73+
# Solution is to call `set` again, to get good ticks again.
6974
end
7075
end

0 commit comments

Comments
 (0)