Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add example for a stacked horizontal bar chart #14262

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
May 26, 2019

Conversation

timhoffm
Copy link
Member

@timhoffm timhoffm commented May 19, 2019

PR Summary

There's only one example for a simple (vertical) stacked bar chart. I think this is a worthwhile addition:

  • It's showing the general approach how to stack multiple bars.
  • It's illustrates a certain kind of common diagram.
  • It shows how to draw labels with values at the bar centers.

Example:

image

@timhoffm timhoffm force-pushed the example-horizontal-stacked-bar branch from 6a9647f to 7cdfdf0 Compare May 19, 2019 18:27
Copy link
Member

@efiring efiring left a comment

Choose a reason for hiding this comment

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

Nice example.


import matplotlib
matplotlib.axes.Axes.barh
matplotlib.pyplot.barh
Copy link
Member

Choose a reason for hiding this comment

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

Why are the pyplot versions included in this list, when they aren't used in the example?

Choose a reason for hiding this comment

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

This reference section

  • provides a link to the function doc page
  • ensures that the function doc page contains a link to the respective example

For the first point, one could argue that no such link is needed. The second point however makes this useful; people often arrive at the pyplot function docs (e.g. by googling "matplotlib barh") - in this case they might want to see the same example linked, even if it does not necessarily use plt.barh, but ax.barh instead.

@ImportanceOfBeingErnest ImportanceOfBeingErnest added this to the v3.1-doc milestone May 25, 2019
@ImportanceOfBeingErnest
Copy link
Member

ImportanceOfBeingErnest commented May 25, 2019

I like the example (and its very clean), so approving. I do wonder though if it wasn't better be put in the same section as other bar examples, because the functionality that is presented is not limited to statistical representations.

@timhoffm
Copy link
Member Author

Fair point I’ll move the example to the other section.

@timhoffm timhoffm force-pushed the example-horizontal-stacked-bar branch from 7cdfdf0 to d65fbfd Compare May 26, 2019 17:15
@timhoffm timhoffm force-pushed the example-horizontal-stacked-bar branch from d65fbfd to b3b3e21 Compare May 26, 2019 17:16
@timhoffm
Copy link
Member Author

Moved to section "lines, bars and markers". This is ready to go.

@efiring efiring merged commit 3a7a47a into matplotlib:master May 26, 2019
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request May 26, 2019
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request May 26, 2019
@timhoffm timhoffm deleted the example-horizontal-stacked-bar branch May 26, 2019 19:33
timhoffm added a commit that referenced this pull request May 26, 2019
…262-on-v3.1.x

Backport PR #14262 on branch v3.1.x (Add example for a stacked horizontal bar chart)
timhoffm added a commit that referenced this pull request May 26, 2019
…262-on-v3.1.0-doc

Backport PR #14262 on branch v3.1.0-doc (Add example for a stacked horizontal bar chart)
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.

3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.