8000 Use anchor rotation_mode in text rotation example. · matplotlib/matplotlib@07cca4e · GitHub
[go: up one dir, main page]

Skip to content

Commit 07cca4e

Browse files
committed
Use anchor rotation_mode in text rotation example.
This keeps the location in a relatively normal place. Also, fix the text to actually be different between the two objects.
1 parent 6919d2a commit 07cca4e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

examples/pylab_examples/text_rotation_relative_to_line.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626
# Rotate angle
2727
angle = 45
2828
trans_angle = plt.gca().transData.transform_angles(np.array((45,)),
29-
l2.reshape((1, 2)))[0]
29+
l2.reshape((1, 2)))[0]
3030

3131
# Plot text
3232
th1 = plt.text(l1[0], l1[1], 'text not rotated correctly', fontsize=16,
33-
rotation=angle)
34-
th2 = plt.text(l2[0], l2[1], 'text not rotated correctly', fontsize=16,
35-
rotation=trans_angle)
33+
rotation=angle, rotation_mode='anchor')
34+
th2 = plt.text(l2[0], l2[1], 'text rotated correctly', fontsize=16,
35+
rotation=trans_angle, rotation_mode='anchor')
3636

3737
plt.show()

0 commit comments

Comments
 (0)
0