将科学记数法指数移动到 matplotlib 中 y 轴的右侧 [英] Move scientific notation exponential to right side of y axis in matplotlib

查看:39
本文介绍了将科学记数法指数移动到 matplotlib 中 y 轴的右侧的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经绘制了这样的图

I have plotted a figure like this

现在我想将科学记数法偏移 1e4 移动到右侧 y 轴的右侧,最好将其移动到 1.8 标签的右上角.我该怎么做?

Now I want to move the scientific notation offset 1e4 to the right of the right y axis, best move it to the upper right of 1.8 label. How can I do this?

推荐答案

这应该有效:

t = ax.yaxis.get_offset_text()
t.set_x(1.1)

使用 ax 你的右轴.但是y位置不能改变,所以如果不满意,可以隐藏偏移文本,在正确的位置(x,y)手动创建:

with ax your right axis. However, you cannot change the y position, so if you are not satisfied with it, you can hide the offset text and create it manually at the right position (x,y):

ax.yaxis.get_offset_text().set_visible(False)
text(x, y, "1e4")

这篇关于将科学记数法指数移动到 matplotlib 中 y 轴的右侧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆