0

I know that the positioning of the text with the matplotlib.pyplot.text() has a transform keyword used to set the text positionning in data or axis coordinates.

However, I would like to position the text in my plot using the data coordinates in x, AND the axis coordinates for y.

The reason is that if I change the view of my plot (change of x_axis and y_axis view limits), I would like that my text appears always at the same vertical position in my plot, while the horizontal positioning respects the data coordinate.

Is it possible to do it simple?

1 Answer 1

2

Yes,

ax.text(140, 0.8, "My Text", transform=ax.get_xaxis_transform())
Sign up to request clarification or add additional context in comments.

1 Comment

This is exactly what I was looking for! Thanks!

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.