Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get xtick labels in matplotlib returns empty array?

For the following code:

ax = plt.gca()
ticks = ax.get_xticklabels(True)
ax.set_xticklabels(labels,True)
plt.show()

The set_xticklabels is working and the plot is shown as expected . But the get_xticklabels returns an empty list. Is there any way to obtain the 'default' xticklabels before they are manually set?

like image 578
WestCoastProjects Avatar asked Mar 26 '26 04:03

WestCoastProjects


1 Answers

I think the function you need is ax.get_xticks()

like image 94
SZ999 Avatar answered Mar 28 '26 17:03

SZ999



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!