Owen
Owen

Reputation: 427

Move scientific notation exponential to right side of y axis in matplotlib

I have plotted a figure like thisenter image description here

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?

Upvotes: 5

Views: 4388

Answers (1)

j_4321
j_4321

Reputation: 16169

This should work:

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

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")

Upvotes: 8

Related Questions