Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Center of rotation for text with rotation_mode='anchor' #13044

Open
@timhoffm

Description

@timhoffm

Bug report

After fixing an obvious vertical offset bug in #13029 the rotation

import matplotlib.pyplot as plt
plt.plot([0, 1], lw=0)
plt.axvline(.5, linewidth=.5, color='.5')
plt.axhline(.5, linewidth=.5, color='.5')

N = 4
for r in range(N):
    plt.text(.5, .5, 'pP', color=plt.get_cmap('jet')(r/N), size=100, rotation=r/N*360, va='center_baseline', rotation_mode='anchor')

looks like this:
image

I'm not sure if this is now 100% as desired:

  • The vertical position of the rotation point is not exactly at y=0.5 (slightly shifted down).
  • The horizontal position of the rotation point is not at x=0.5 but at the left edge of the first letter.

Is this intended or are there still other bugs in the position calculation?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Difficulty: Mediumhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issuesGood first issueOpen a pull request against these issues if there are no active ones!keepItems to be ignored by the “Stale” Github Actiontopic: text

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions