How to do text rotation relative to a line in matplotlib using python?

Viewed 187

My goal is to add a short text string along a straight line in a matplotlib graph.

The matplotlib page https://matplotlib.org/3.1.0/gallery/text_labels_and_annotations/text_rotation_relative_to_line.html answers my need perfectly and provides code to generate the following diagram: Comparing properly rotated to improperly rotated text

Now if I change the URL from 3.1.0 to 3.2.1, as follows, https://matplotlib.org/3.2.1/gallery/text_labels_and_annotations/text_rotation_relative_to_line.html I get the exact same page, but the diagram is wrong.

enter image description here

This second diagram matches what I see in my application when I use this solution.

Is this a bug in the newer version of matplotlib, or did some matplotlib API change and the documentation page has become out of date?

But most importantly, how do I align some text along a straight line in matplotlib?

0 Answers
Related