Skip to content
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

horizontalalignment 'left' and 'right' do not handle spacing consistently #4380

Closed
jason-sachs opened this issue Apr 24, 2015 · 11 comments
Closed
Milestone

Comments

@jason-sachs
Copy link

horizontalalignment respects leading spaces with left-alignment, ignores trailing spaces

import matplotlib.pyplot as plt

fig = plt.figure(figsize=(8,6))
ax = fig.gca()
ax.plot([0,0],[-1,1],':')
for k in xrange(5):
    spc = " "*k
    ax.text(0.0,0.1*k,spc+"%d leading spaces"%k, ha='left')
    ax.text(0.0,0.1*k,("%d trailing spaces"%k)+spc, ha='right')

image

@jason-sachs
Copy link
Author

It shouldn't ignore any spaces... otherwise why would I put them there?

@OceanWolf
Copy link
Member

Actually I see it working fine on master...

@jason-sachs
Copy link
Author

oh? hmm, let me grab version info...

@jason-sachs
Copy link
Author

darnit, I'm still using 1.3.1. Let me try upgrading...

@OceanWolf
Copy link
Member

The image produced from a copy-paste of your example...
figure_1

@jason-sachs
Copy link
Author

just tried it in 1.4.3 (latest Anaconda version), got same result (ignores trailing spaces). Any way to see if it has been fixed recently or if it is a platform-specific bug?

@OceanWolf
Copy link
Member

I have just run your code on 1.4.2 and I do see the bug, so yes, it seems it has already been fixed. Kinda new here so I don't know all the bugs that have been fixed, but yes, definitely fixed. You can either try out the master, or wait until the next full release in a few months time.

@tacaswell
Copy link
Member

@mdboom Do you remember fixing this?

@jason-sachs
Copy link
Author

You can either try out the master, or wait until the next full release in a few months time.

I'll wait; I just used the annotate() function with offset points to draw text with an offset.

It might be nice to add an offset_points kwarg... the text() function is so much easier to use than annotate() if you just need text and no arrows.

@petehuang
Copy link
Contributor

Reconfirming the fix (this time with 1.5.3). Can we close?

@QuLogic
Copy link
Member

QuLogic commented Jan 10, 2017

Works for me too.

@QuLogic QuLogic closed this as completed Jan 10, 2017
@QuLogic QuLogic added this to the v1.5.0 milestone Jan 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants