You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FWIW, if it is not the correct behavior, I was able to reproduce @astrofog's output on Matplotlib 1.5.3 (on GNU/Linux with Python 3.6.2 from conda)...
Just in case, looking at FuncFormatter docstring, the expected signature is formatter_func(x, pos): @astrofrog is this consistent with what you intended?
diff --git a/lib/matplotlib/axis.py b/lib/matplotlib/axis.py
index 6cc38bb90..39ac54de1 100644
--- a/lib/matplotlib/axis.py
+++ b/lib/matplotlib/axis.py
@@ -1052,11 +1052,11 @@ class Axis(artist.Artist):
for tick, loc, label in tick_tups:
if tick is None:
continue
- if not mtransforms.interval_contains(interval_expanded, loc):
- continue
tick.update_position(loc)
tick.set_label1(label)
tick.set_label2(label)
+ if not mtransforms.interval_contains(interval_expanded, loc):
+ continue
ticks_to_draw.append(tick)
return ticks_to_draw
fixes the issue. Basically, the idea is to update the tick labels (and positions) even if they're not going to be drawn (this should be fairly cheap). Feel free to turn the patch into a PR.
I've argued in a few places that we should just be more careful to actually only have the ticks that are going to be drawn, and not have excess ones on either side.
In the following example I am getting back the wrong labels from
ax.xaxis.get_ticklabels
:This gives:
whereas I expected:
The text was updated successfully, but these errors were encountered: