Skip to content

Instantly share code, notes, and snippets.

@jingningzhang1
Last active June 24, 2022 23:21
Show Gist options
  • Save jingningzhang1/f4c4aeeec5e026531b8611b0402c428f to your computer and use it in GitHub Desktop.
Save jingningzhang1/f4c4aeeec5e026531b8611b0402c428f to your computer and use it in GitHub Desktop.
def generate_scatter(df, xaxis, comp):
axis_labels = {
"age": "Age (years)",
"height": "Height (inches)",
"weight": "Weight (lbs)",
}
fig = px.scatter(
df,
x=xaxis,
y="risk",
color=comp,
color_discrete_sequence=custom_color[comp],
size="Total",
labels={xaxis: axis_labels[xaxis]},
title=f"Comparative Risk by Demographic",
)
return fig_style(fig)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment