Skip to content

adding a diverging bar example to the horizontal bar documentation #4994

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 12 commits into from
Apr 17, 2025

Conversation

rl-utility-man
Copy link
Contributor

@rl-utility-man rl-utility-man commented Jan 29, 2025

Documentation PR

  • [ Y ] I've seen the doc/README.md file
  • [ Yes, it works on 6.0.0 ] This change runs in the current version of Plotly on PyPI and targets the doc-prod branch OR it targets the master branch
  • [ N/A ] If this PR modifies the first example in a page or adds a new one, it is a px example if at all possible
  • [ Y ] Every new/modified example has a descriptive title and motivating sentence or paragraph
  • [ Y ] Every new/modified example is independently runnable
  • [ Y ] Every new/modified example is optimized for short line count and focuses on the Plotly/visualization-related aspects of the example rather than the computation required to produce the data being visualized
  • [ Y ] Meaningful/relatable datasets are used for all new examples instead of randomly-generated data where possible
  • [ N/A ] The random seed is set if using randomly-generated data in new/modified examples
  • [ Y] New/modified remote datasets are loaded from https://plotly.github.io/datasets and added to https://github.com/plotly/datasets
  • [ Y ] Large computations are avoided in the new/modified examples in favour of loading remote datasets that represent the output of such computations
  • [ Y ] Imports are plotly.graph_objects as go / plotly.express as px / plotly.io as pio
  • [ Y ] Data frames are always called df
  • [ Y ] fig = <something> call is high up in each new/modified example (either px.<something> or make_subplots or go.Figure)
  • [ Y ] Liberal use is made of fig.add_* and fig.update_* rather than go.Figure(data=..., layout=...) in every new/modified example
  • [ Y] Specific adders and updaters like fig.add_shape and fig.update_xaxes are used instead of big fig.update_layout calls in every new/modified example
  • [ Y ] fig.show() is at the end of each new/modified example
  • [ Y ] plotly.plot() and plotly.iplot() are not used in any new/modified example
  • [ Y ] Hex codes for colors are not used in any new/modified example in favour of these nice ones

Code PR

  • I have read through the contributing notes and understand the structure of the package. In particular, if my PR modifies code of plotly.graph_objects, my modifications concern the codegen files and not generated files.
  • I have added tests (if submitting a new feature or correcting a bug) or
    modified existing tests.
  • For a new feature, I have added documentation examples in an existing or
    new tutorial notebook (please see the doc checklist as well).
  • I have added a CHANGELOG entry if fixing/changing/adding anything substantial.
  • For a new feature or a change in behaviour, I have updated the relevant docstrings in the code to describe the feature or behaviour (please see the doc checklist as well).

-->

@gvwilson gvwilson requested a review from LiamConnors February 3, 2025 15:41
@gvwilson gvwilson added P2 considered for next cycle community community contribution documentation written for humans labels Feb 3, 2025
SimaRaha and others added 2 commits February 5, 2025 23:45
An example of a butterfly chart/diverging bar chart has been added.
@rl-utility-man
Copy link
Contributor Author

the only thing we changed is horizontal-bar-charts.md

@rl-utility-man
Copy link
Contributor Author

Thanks @gvwilson for merging plotly/datasets#63. We believe this example and its sister commit #4984 now follow the applicable Plotly best practices and look forward to getting feedback from @LiamConnors or another appropriate reviewer!

@gvwilson
Copy link
Contributor

@LiamConnors can you please review for the Plotly.py 6.1 release?

Copy link
Member

@LiamConnors LiamConnors left a comment

Choose a reason for hiding this comment

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

Looks good @rl-utility-man. Thanks for creating this PR.
Just left a few small comments and questions

Comment on lines 237 to 245
fig = go.Figure()
# this color palette conveys meaning: blues for negative, reds for positive, gray for Neither Agree nor Disagree
color_by_category={
"Strongly Agree":'darkblue',
"Agree":'lightblue',
"Disagree":'orange',
"Strongly Disagree":'red',
"Neither Agree nor Disagree":'gray',
}
Copy link
Member

Choose a reason for hiding this comment

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

Should this say "blues for positive" and "reds for negative"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, corrected.

@rl-utility-man
Copy link
Contributor Author

Looks good @rl-utility-man. Thanks for creating this PR. Just left a few small comments and questions

Thanks @LiamConnors for spotting these issues. I hope I have resolved them. Normally, @SimaRaha who did so much of this would have responded, but she's otherwise committed this week. #4984 is a continuation of this example and I would be delighted if we considered them together.

@LiamConnors LiamConnors self-requested a review March 31, 2025 14:31
Copy link
Member

@LiamConnors LiamConnors left a comment

Choose a reason for hiding this comment

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

Just a few small comments. Thanks for opening this PR

rl-utility-man and others added 2 commits March 31, 2025 15:15
adding python decorator

Co-authored-by: Liam Connors <[email protected]>
Co-authored-by: Liam Connors <[email protected]>
@rl-utility-man
Copy link
Contributor Author

Just a few small comments. Thanks for opening this PR

Glad @SimaRaha and I could help! Good suggestions @LiamConnors. I accepted and committed them! Looking forward to merging this one and considering the continuation of this example in #4984

Comment on lines 222 to 223
Diverging bar charts show counts of positive outcomes or sentiments to the right of zero and counts of negative outcomes to the left of zero, allowing the reader to easily spot areas of excellence and concern. This example leaves the number of people offering a neutral response implicit because the categories add to 100%.

Copy link
Member

Choose a reason for hiding this comment

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

This looks good and it's ready to merge, but I just want to check the wording on "This example leaves the number of people offering a neutral response implicit because the categories add to 100%." Should this say "
This example leaves the number of people offering a neutral response implicit because the categories don't add up to 100%."
Is that how we know there are neutral responses that are not shown here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes! Good point. I tried a rewrite of your wording that's hopefully a little more direct. I'm open to your wording as well.

@LiamConnors LiamConnors merged commit 88fcb7d into plotly:main Apr 17, 2025
4 checks passed
@rl-utility-man
Copy link
Contributor Author

rl-utility-man commented Apr 17, 2025

@LiamConnors I'm thrilled to see this merged. I just realized we requested that it be merged into "main" rather than "doc-prod" so it's not currently showing up on the website. Please advise about whether and how I should address that. Should I e.g. open a PR to merge this or main into doc-prod?

@LiamConnors
Copy link
Member

@rl-utility-man, if you want to open a PR that has these commits and targets doc-prod, I'll merge it in. Let me know if I can help. Thanks again for this PR

@rl-utility-man
Copy link
Contributor Author

@LiamConnors I just created #5148 to insert the same change into doc-prod. I just copied the change from the "files changed" tab. Much appreciated. I enjoyed working with you and @SimaRaha on this PR and very much appreciate your help. We've also responded to your comments on its sibling PR, #4984

LiamConnors added a commit that referenced this pull request Apr 22, 2025
Applying changes that #4994 made to "main" to "doc-prod"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community community contribution documentation written for humans P2 considered for next cycle
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants