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
{{ message }}
Repository navigation
Locators: First visible tick does not have pos=0 #2509
I noticed that various Locators have problems designating pos=0 to the first visible tick. While this might not be very important for most people, I still thought I'd mention it here.
For AutoDateLocator this happens below a certain threshold of x range. Below an x range of around 5e-5 (equal to approximately 5 seconds) the tick with position 0 is not inside the plot anymore.
I admit that this is a rather low value for date plots and thus might be considered very low priority.
For AutoLocator this seems to be a general problem. Almost always the first visible tick has position 1.
The following script demonstrates both cases. Zoom in/out on x axes and look at pos of the first tick.
importmatplotlib.pyplotaspltfrommatplotlib.tickerimportFuncFormatterfromnumpy.randomimportrandndefprint_pos(x, pos=None):
return"%s: %s"% (str(pos), str(x))
fig=plt.figure(figsize=(16, 6))
fig.suptitle("xticklabels are 'pos: x'")
ax=fig.add_subplot(211)
left=10right=left+6e-5ax.plot_date([left, right], [1, 1])
ax.xaxis.set_major_formatter(FuncFormatter(print_pos))
ax.set_title("zoom in: leftmost tick has position 1")
ax=fig.add_subplot(212)
ax.plot(randn(20), randn(20))
ax.xaxis.set_major_formatter(FuncFormatter(print_pos))
ax.set_title("zoom in/out: leftmost tick has position 1")
plt.show()
The pos is assigned in the Axis.iter_ticks() method, before a final decision is made on which ticks will actually be drawn, which is in the Axis._update_ticks() method. The tick handling code is very complex.
pos is on implementation detail that should not be leaking out to userland.
Well, when implementing a FuncFormatter it is one of two pieces of information that the user can work with, so I would tend to disagree that it's "inadvertently leaking out".
But, yeah, might not be super important, so it can stay closed, I guess.
Activity
tacaswell commentedon Feb 27, 2014
punting this to 1.5 as I am not clear why this is a problem and will probably involve a re-write of the
AutoLocatorfamily.efiring commentedon Feb 27, 2014
The pos is assigned in the
Axis.iter_ticks()method, before a final decision is made on which ticks will actually be drawn, which is in theAxis._update_ticks()method. The tick handling code is very complex.tacaswell commentedon Nov 26, 2014
Closing as this seems to be an intentional part of the design and pos is on implementation detail that should not be leaking out to userland.
tacaswell commentedon Nov 26, 2014
@megies If you disagree, please ping me and we can re-open this.
megies commentedon Nov 27, 2014
Well, when implementing a
FuncFormatterit is one of two pieces of information that the user can work with, so I would tend to disagree that it's "inadvertently leaking out".But, yeah, might not be super important, so it can stay closed, I guess.
issue matplotlib#24617 fixed getter from matplotlib#2509