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

Update bachelors_degree_by_gender example. #6874

Merged

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Jul 31, 2016

Use plt.grid() instead of manually adding grid lines (this requires
slightly changing the xlims to have a similar spacing).

Use FuncFormatters instead of fixed tick labels, both for generality and so
that the interactive cursor position text is properly formatted.

Add a show() at the end.

Use plt.grid() instead of manually adding grid lines (this requires
slightly changing the xlims to have a similar spacing).

Use FuncFormatters instead of fixed tick labels, both for generality and so
that the interactive cursor position text is properly formatted.

Add a `show()` at the end.
for x in range(0, 91, 10)], fontsize=14)
plt.yticks(range(0, 91, 10), fontsize=14)
ax.xaxis.set_major_formatter(plt.FuncFormatter('{:.0f}'.format))
ax.yaxis.set_major_formatter(plt.FuncFormatter('{:.0f}%'.format))
Copy link
Member

Choose a reason for hiding this comment

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

You can simply use '{:.0%}'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, because this would multiply the entries by 100 (they are in [0, 100], not [0, 1]).

Copy link
Member

Choose a reason for hiding this comment

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

Ahh, yes, sorry.

@tacaswell tacaswell merged commit 0cfc7a8 into matplotlib:master Aug 1, 2016
tacaswell added a commit that referenced this pull request Aug 1, 2016
DOC: Update bachelors_degree_by_gender example.
@tacaswell
Copy link
Member

backported to v2.x as be37777

@anntzer anntzer deleted the update-bachelors-degree-by-gender branch August 1, 2016 03:01
@QuLogic QuLogic added this to the 2.0 (style change major release) milestone Aug 1, 2016
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

Successfully merging this pull request may close these issues.

None yet

5 participants