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

Skip to content

ENH: add pad kwarg to set_title #9816

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

Merged
merged 1 commit into from
Nov 20, 2017

Conversation

jklymak
Copy link
Member

@jklymak jklymak commented Nov 19, 2017

PR Summary

This adds a pad kwarg to axes.set_title().

I was writing some docs on set_title() and was surprised the only way to change the pad was via rcParams. This sets the default to be rcParams, but accepts a float to specify the number of points.

fig, axs = plt.subplots()
tt = axs.set_title('Boo', pad=30.)

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • [N/A] Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@jklymak jklymak changed the title ENH: add pad kwarg to set_title WIP: ENH: add pad kwarg to set_title Nov 19, 2017
@tacaswell
Copy link
Member

Can you add a whats_new for this?

# check that title padding puts the title in the right
# place...
fig, ax = plt.subplots()
ax.set_title('aardvark', pad=30.)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 for use of 'aardvark'!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wish I could claim credit, but I just cut and pasted from elsewhere. I hope its a good inside joke...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well at least it is likely to be the first word in English-dictionaries, isn't it ^^? It may actually be(come) a running gag in Matploltib code too: I used it as well in some tests with strings, copy-pasting it from some other existing code section as @jklymak did... (I did not even understand it was a proper word at that time 🐑 )

Copy link
Member

@tacaswell tacaswell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modulo a whats_new entry.

@jklymak jklymak changed the title WIP: ENH: add pad kwarg to set_title ENH: add pad kwarg to set_title Nov 20, 2017
@jklymak jklymak added this to the v2.2 milestone Nov 20, 2017
@dopplershift dopplershift merged commit 4389baf into matplotlib:master Nov 20, 2017
@jklymak jklymak deleted the add-title-pad branch November 20, 2017 22:15
@jklymak jklymak restored the add-title-pad branch November 22, 2017 04:53
@jklymak jklymak deleted the add-title-pad branch November 22, 2017 05:00
@QuLogic QuLogic modified the milestones: needs sorting, v2.2.0 Feb 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants