-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Center of rotation for text with rotation_mode='anchor' #13044
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Labelled as
|
We should also check that this is consistent between the backends (ie, png / svg / pdf all have the same problem). |
@timhoffm Looks like the problem is not with the rotation center, but with the bounding box and the text: import matplotlib.pyplot as plt
fig, axes = plt.subplots(2, 2)
for idx, ax in enumerate(axes.flatten()):
ax.axvline(.5, linewidth=.5, color='.5')
ax.axhline(.5, linewidth=.5, color='.5')
ax.text(
.5, .5, 'pP', size=50,
bbox=dict(facecolor='None', edgecolor='red', pad=0),
rotation=idx*90,
va='center_baseline',
rotation_mode='anchor'
) |
Hi everyone, I am Zareef, and I am very new to contributing to open source projects. I was wondering if me and my friend could contribute to this issue for a class at my university. |
@safdarzareef You are very welcome to contribute if you think you're basically able to resolve the issue. While we're available for targeted questions, we don't have the capacity for close mentoring (We had some bad experiences in the past from university class contributors that essentially needed as step-by-step guidance how to approach and resolve the issue). Also there's already a proposed patch #19114. So first step would be to check that and determine if this is a good approach and only needs some additions. |
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help! |
Is this issue still open? If yes, does this make sense or look little better? @timhoffm ![]() 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):
text = plt.text(.5, .5, 'pP', color=plt.get_cmap('jet')(r/N), size=100, rotation=r/N*360, va='center_baseline', rotation_mode='anchor')
text.set_rotation(r/N*360)
text.set_position((.5, .5))
plt.show() seems like it handles this issue -> The vertical position of the rotation point is not exactly at y=0.5 (slightly shifted down). |
@tacaswell tried making this change!
|
@timhoffm Hello! I'm Evelyn, and I'm interested in helping resolve this issue. Can me and my friends work on this issue? |
@evelyn-lo sure. This is a classic debug topic. You need to find out why the behavior is like it is. It's likely somewhere in the numerics of the calculation. |
Bug report
After fixing an obvious vertical offset bug in #13029 the rotation
looks like this:

I'm not sure if this is now 100% as desired:
Is this intended or are there still other bugs in the position calculation?
The text was updated successfully, but these errors were encountered: