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
Post a Comment