0

My code contains the following lines:

from matplotlib.figure import Figure

figure = Figure(figsize=(10, 5), dpi=dpi)

How can I add text to this

1 Answer 1

1

Texts can be added from a axis object. So you may try this:

from matplotlib.figure import Figure
figure = Figure(figsize=(10, 5), dpi=dpi)
ax = figure.add_axes((0.05, 0.05, 0.9, 0.9))
ax.text(0.5, 0.5, 'Text', ha='center')

More examples can see the document, and details of parameters here

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

Comments

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.