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

Cropping text to axes #5554

Closed
anntzer opened this issue Nov 24, 2015 · 4 comments
Closed

Cropping text to axes #5554

anntzer opened this issue Nov 24, 2015 · 4 comments

Comments

@anntzer
Copy link
Contributor

anntzer commented Nov 24, 2015

After text(-.01, -.01, "foo"), the text is drawn on top of the axes.
An option to crop the text to the axes limits would be welcome. At least, changing the zorder doesn't seem to be enough.

@mdboom
Copy link
Member

mdboom commented Nov 24, 2015

Does

text.set_clip_path(ax.patch)

work?

@tacaswell
Copy link
Member

By default the Text object returned by ax.text has clipping disabled, turn in on via:

txt =  ax.text(.7, .7, 'very long string' * 50, clip_on=True)

or

txt.set_clip_on(True)

@anntzer
Copy link
Contributor Author

anntzer commented Nov 24, 2015

Sorry for the spam.

A general suggestion: would it be possible, whenever a docstring of a pyplot function states something like

    kwargs : `~matplotlib.text.Text` properties.
        Other miscellaneous text parameters.

(from pyplot.text) to actually fill in the list of properties? (I guess I just self-assigned that project.)

@gepcel
Copy link
Contributor

gepcel commented Jan 6, 2016

Agree with @anntzer . For someone not an expert with matplotlib, I have to dig deep into the help file to set maybe just a font size. Many times I just don't know there such a parameter, or can't spell the parameter correctly.
Probably too late to suggest.

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

4 participants