Skip to content

Instantly share code, notes, and snippets.

@databyjp
Last active February 17, 2022 05:18
Show Gist options
  • Save databyjp/220d62638470dcb2c9e57fdca1684a19 to your computer and use it in GitHub Desktop.
Save databyjp/220d62638470dcb2c9e57fdca1684a19 to your computer and use it in GitHub Desktop.
fig = px.scatter(df, x="DEF_RATING", y="OFF_RATING",
color="legend",
title=f"Game-by-game performances by the {highlight_tm} - '21-'22",
color_discrete_sequence=["#eeeeee", color_dict[highlight_tm][0], color_dict[highlight_tm][1]],
size="inv_days_since_game",
size_max=18,
template="plotly_white",
width=1200, height=800,
labels={"OFF_RATING": "Offensive Rating (higher is better)",
"DEF_RATING": "Dffensive Rating (to the left is better)",
"legend": ""}
)
fig['data'][0]['marker']['line']['color'] = "#b0b0b0"
fig['data'][0]['marker']['opacity'] = 0.05
# Add reference lines
fig.add_hline(y=rtg_mid, line_width=1, line_color="#b0b0b0")
fig.add_vline(x=rtg_mid, line_width=1, line_color="#b0b0b0")
fig.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment