Skip to content

Instantly share code, notes, and snippets.

@databyjp
Created March 17, 2022 12:48
Show Gist options
  • Select an option

  • Save databyjp/2c98f292d3cdce47d89d453f41014769 to your computer and use it in GitHub Desktop.

Select an option

Save databyjp/2c98f292d3cdce47d89d453f41014769 to your computer and use it in GitHub Desktop.
tm_ranks = gdf_tot.groupby("team").sum()["rel_pts"].sort_values().index.to_list()
fig = px.bar(gdf_tot, x="team", facet_row="shot_zone", y="shot_freq", color="rel_ev",
color_continuous_scale=px.colors.diverging.RdYlBu_r, color_continuous_midpoint=0,
category_orders={"team": tm_ranks})
fig.update_traces(marker=dict(line=dict(width=1, color='DarkSlateGrey')))
fig.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment