Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Closed
Milestone
Description
In the following example I am getting back the wrong labels fromax.xaxis.get_ticklabels
:
importmatplotlib.pyplotaspltfrommatplotlib.tickerimportFuncFormatter,MaxNLocatorax=plt.subplot(1,1,1)defformatter_func(pos,*args):return'a'ifpos==1else''ax.figure.canvas.draw()print([tick.get_text()fortickinax.xaxis.get_ticklabels()])ax.xaxis.set_major_formatter(FuncFormatter(formatter_func))ax.xaxis.set_major_locator(MaxNLocator(10,integer=True))ax.set_xlim(-0.5,2.5)ax.figure.canvas.draw()print([tick.get_text()fortickinax.xaxis.get_ticklabels()])
This gives:
['0.0', '0.2', '0.4', '0.6', '0.8', '1.0']['0.0', '', 'a', '', '0.8']
whereas I expected:
['0.0', '0.2', '0.4', '0.6', '0.8', '1.0']['', '', 'a', '', '']
Metadata
Metadata
Assignees
Labels
No labels