python - get the tick labels from a plot and use for another plot -


i trying values of xticks 1 plot , use these values plot set new ticks 10 power of other plot's ticks. following lines doesn't job aiming for

labels=[item item in ax1.get_xticklabels()] ax2.set_xticklabels(['$10^{{{:d}}}$'.format(int(i)) in labels]) 

i appreciate suggestion.

what sharing axes ? fix same limits , number of ticks ax1 , ax2 :

fig, ax = plt.subplots(1, 2, sharex=true) ax1 = ax[0] ax2 = ax[1] 

then code trick since sure both subplots have same xticks

labels = [item item in ax2.get_xticklabels()] ax2.set_xticklabels(['$10^{{{:d}}}$'.format(int(i)) in labels]) 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -