-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Remove Axes sublists from docs #22279
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
Conversation
# Adding from the top matches the legend without have to explicitly re-order | ||
# the legend. | ||
for j, height in enumerate(reversed(approved_ratios)): | ||
bottom -= height | ||
bc = ax2.bar(0, height, width, bottom=bottom, color='C0', | ||
alpha=0.1 + 0.25 * j) | ||
ax2.bar_label(bc, labels=["%d%%" % (height * 100,)], label_type='center') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This breaks the association of approved_ratios
to the legend labels.
Anyway, legend(labels)
is a bad idea because you rely on the insertion order of artists.
I suggest you do
age_ratios = [.33, .54, .07, .06]
age_labels = ['Under 35', '35-49', '50-65', 'Over 65']
for j, height, label in ...:
....
ax2.bar(..., label=label)
ax2.legend()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what you mean about breaking the association, but I applied the change anyway.
... by saving and using the results from Axes method calls. Also, replace the colour palette in the bar chart.
6c2e79b
to
88433b8
Compare
…279-on-v3.5.1-doc Backport PR #22279 on branch v3.5.1-doc (Remove Axes sublists from docs)
…279-on-v3.5.x Backport PR #22279 on branch v3.5.x (Remove Axes sublists from docs)
PR Summary
There are some bits of the tutorials that should have been changed to remove reference to modifying the Axes sublists.
Also remove the use of the sublists in the 'bar of pie' example, and improve its colours.
PR Checklist
Tests and Styling
pytest
passes).flake8-docstrings
and runflake8 --docstring-convention=all
).Documentation
doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).