如何在 matplotlib 中将轴标签重新格式化为科学记数法?

How can I reformat axis labels to scientific notation in matplotlib?

我制作了这张图 使用我粘贴的代码 here.

如何将最右边的 y 标签重新格式化为与最左边的 y 轴相同的符号?我的代码的相关部分是:

ax1.set_ylabel('Flux sensitivity, $\Delta S$ [Jy]')
ax1.set_xlabel('Integration time [s]')
ax1.set_xscale('log')
ax1.set_yscale('log')
ax1.grid(True)

ax2 = ax1.twiny()
hours = [0.03, 0.28, 2.78, 27.8, 278]
seconds = [1e2, 1e3, 1e4, 1e5, 1e6]
ax2.set_xscale('log')
ax2.set_xticks(seconds)
ax2.set_xticklabels(hours, rotation = 0)
ax2.set_xlabel('Integration time [hours]')
ax2.set_xlim(ax1.get_xlim())

ax3 = ax1.twinx()
WmHz   = [1e-30, 1e-31, 1e-32, 1e-33]
jansky = [1e-4, 1e-5, 1e-6, 1e-7]
ax3.set_yscale('log')
ax3.set_yticks(jansky)
ax3.set_yticklabels(WmHz, rotation = 0)
ax3.set_ylabel(r'Flux sensitivity [W m$^{-2}$ Hz$^{-1}$]')
ax3.set_ylim(ax1.get_xlim())

已解决:我将 WmHz 列表格式化为

WmHz = [r'^{-30}$', r'^{-31}$', r'^{-32}$', r'^{-33}$']