-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
DOC: Update multiple category bar chart examples #24498
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
I think if we're gonna go for this, then one of the major reasons would be to provide examples of creating the groupings/stackings using loops 'cause I know that's a common question and I think would help these examples feel more general. |
Sure thing did you want to pick an example to do it for? Using the penguin dataset you can't really extract that many groups (from what I can think of... maybe you can). Unless we want to regress back to one of the original plots and refactor it to use a loop? (is there any best practise way we generate the groups using loops that I can have a look as well or is it up to me to write it) |
I think looping over your list is fine? |
@story645 done |
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 like the bar label demo 👍.
I'm less convinced on the data of the other two plots because they contain a lot of missing data. I think we do not need to show missing data here - full datasets is the standard case and thus a bit simpler. It would also be ok to have one missing data point, but I feel that there is too much missing data for a simple example.
Thanks 👍🏻👍🏻 As for the other examples, I agree there are too many missing data points and it does clutter example. I'm unsure on how to wrangle the actual dataset to make it "clean" for these particular graphs. That's the best I could do for the penguin dataset. We could augment the data and just add some dummy values in and make a comment to say "hey this isn't all real data anymore". Or we could just revert those examples back to the previous graphs and I can refactor those to use for loops. I guess the question is what's more important for these examples; to demonstrate generalities (using loops) or to make the underlying data less arbitrary (in which case I'd try to work with the penguin dataset again). Let me know 🤔 |
Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
Thanks for the clarification @story645. Sure I understand, I won't modify the penguin data. I like your idea and thank you for the drawn out graph viz! I get what your trying to do but I don't think I get it enough to implement it into these examples right now. I guess from me what are the next steps. I can continue and play around the with penguin dataset and try to make it more "complete", or leave it and let you try work your idea into these graphs. Just let me know 👍🏻 |
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.
try to make it more general (no if statements in the loops) and lets see if that cleans up the other two examples?
…hange booleans and labels)
Co-authored-by: Elliott Sales de Andrade <quantum.ana 6D40 lyst@gmail.com>
Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
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.
Needs to iterate over the dict to work, also please fix the syntax errors https://output.circle-artifacts.com/output/job/10abe8b2-316b-497e-a226-f7f579823536/artifacts/0/doc/build/html/gallery/index.html
@story645 should be good to go |
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 think it's good to go except for the space before the plt.subplots() call - the other suggestions are more personal preferences.
I'll merge tomorrow if there are no other comments.
|
||
fig, ax = plt.subplots() | ||
bottom = np.zeros(3) |
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.
bottom = np.zeros(3) | |
bottom = np.zeros(len(species)) |
if you want to be even more generalt
ax.set_title('Scores by group and their beverage choices') | ||
ax.set_xticks(ind, labels=['G1', 'G2', 'G3', 'G4', 'G5']) | ||
ax.legend() | ||
ax.bar_label(p, 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.
is white or a gray easier to read?
|
||
fig, ax = plt.subplots() | ||
bottom = np.zeros(3) |
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.
same as above for generalization
Co-authored-by: hannah <story645@gmail.com>
This has to be rebased/squashed - do you want to do it or should I? |
Happy for you to do it, thanks! |
Thanks for your persistence @kostyafarber ! |
Glad I could help! |
refactor category bar chart examples to use loops and penguin data
PR Summary
The purpose of this PR is to update the multiple category bar chart examples in the documentation; so they are more simple and use non-arbitrary data (penguin dataset). This helps address the problem discussed in #23465 in which the examples were not semantically meaningful.
The examples have also been refactored using loops, to demonstrate general use cases, also in #23465.
PR Checklist
Documentation and Tests
pytest
passes)Release Notes
.. versionadded::
directive in the docstring and documented indoc/users/next_whats_new/
.. versionchanged::
directive in the docstring and documented indoc/api/next_api_changes/
next_whats_new/README.rst
ornext_api_changes/README.rst