1

So I am looking to simply format the offset string (at least that is what i think it is called, see image) that matplotlib places along with an axis that has been set to show tick labels in scientific notation, but where the range is less than one order of magnitude (power of 10).

here is what I am talking about: enter image description here Essentially, how do I make it bigger/coloured?

1 Answer 1

7

you can use ax.yaxis.get_offset_text() to access the offset text. You can then set the size and color on that Text object. For example:

import matplotlib.pyplot as plt
import numpy as np

fig,ax = plt.subplots()
ax.plot(range(10),np.linspace(0,1e11,10))

offset_text = ax.yaxis.get_offset_text()

offset_text.set_size(20)
offset_text.set_color('red')

plt.show()

enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for such a concise and on point answer. Exactly what I was looking for.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.