I want to create a grouped bar chart that shows the median and mean of each group. I'm also using an animation frame to show how each median and mean changes based on the ubi amount.
I want to group these bar charts so that it shows median and mean for each group and how it changes.
Here is my code but I'm stuck on how to group them.
import pandas as pd
import plotly.express as px
summary_med = pd.read_csv('https://github.com/ngpsu22/indigenous-peoples-day/raw/main/native_medians_means')
fig = px.bar(summary_med, x = 'race', y='med_resources_per_person',
animation_frame='monthly_ubi', range_y=[0,25_000],
labels={
"med_resources_per_person": "Median resources per person",
"race": "Race",
"monthly_ubi": "Monthly UBI",
"native": "Native",
"non_native": "Non-native"
},
title="Tax funded UBI and median resources per person",
color='race',
text='med_resources_per_person',
height=900, width=800,
color_discrete_map={'native': '#5886a5',
'non_native': '#5886a5'})
fig.update_traces(texttemplate='$%{text}')
fig.update_layout(showlegend=False, yaxis_tickprefix='$')
fig.show()