-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
adding a diverging bar example to the horizontal bar documentation #4994
base: main
Are you sure you want to change the base?
Conversation
Make docs changes for 6.0.0 live
Update doc-prod with latest on master
Add note on DDK compatibility
An example of a butterfly chart/diverging bar chart has been added.
631756e
to
6c2426a
Compare
the only thing we changed is horizontal-bar-charts.md |
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! |
@LiamConnors can you please review for the Plotly.py 6.1 release? |
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.
Looks good @rl-utility-man. Thanks for creating this PR.
Just left a few small comments and questions
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/refs/heads/master/gss_2002_5_pt_likert.csv') | ||
#data source details are in this CSV file | ||
df.rename(columns={'Unnamed: 0':"Category"}, inplace=True) |
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.
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/refs/heads/master/gss_2002_5_pt_likert.csv') | |
#data source details are in this CSV file | |
df.rename(columns={'Unnamed: 0':"Category"}, inplace=True) | |
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/refs/heads/master/gss_2002_5_pt_likert.csv') | |
df.rename(columns={'Unnamed: 0':"Category"}, inplace=True) |
I don't think a comment is needed here
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', | ||
} |
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.
Should this say "blues for positive" and "reds for negative"?
# Add bars for each category | ||
for col in ["Disagree","Strongly Disagree","Agree","Strongly Agree"]: | ||
fig.add_trace(go.Bar( | ||
y=df["Category"], | ||
x=df[col], | ||
name=col, | ||
orientation='h', | ||
marker=dict(color=color_by_category[col]), | ||
legendrank=legend_rank_by_category[col] | ||
)) |
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.
Should "Neither Agree nor Disagree" also be here?
Documentation PR
doc/README.md
filedoc-prod
branch OR it targets themaster
branchpx
example if at all possibleplotly.graph_objects as go
/plotly.express as px
/plotly.io as pio
df
fig = <something>
call is high up in each new/modified example (eitherpx.<something>
ormake_subplots
orgo.Figure
)fig.add_*
andfig.update_*
rather thango.Figure(data=..., layout=...)
in every new/modified examplefig.add_shape
andfig.update_xaxes
are used instead of bigfig.update_layout
calls in every new/modified examplefig.show()
is at the end of each new/modified exampleplotly.plot()
andplotly.iplot()
are not used in any new/modified exampleCode PR
plotly.graph_objects
, my modifications concern thecodegen
files and not generated files.modified existing tests.
new tutorial notebook (please see the doc checklist as well).
-->