Skip to content

Instantly share code, notes, and snippets.

@Dhrumilcse
Created May 20, 2021 23:16
Show Gist options
  • Save Dhrumilcse/df05b2b747455a537caccd017e721f32 to your computer and use it in GitHub Desktop.
Save Dhrumilcse/df05b2b747455a537caccd017e721f32 to your computer and use it in GitHub Desktop.
# Bar chart
def plot_data(data):
data['Count'] = 1
plot_data = data[['amount','currency','Count']]
plot_data = plot_data.groupby(["currency"],as_index=False).Count.sum()
with chart_output:
print("Total data: ", len(data))
plot_bar(plot_data, x="currency", y="Count", color="currency")
# Bar Chart helper
def plot_bar(data, x, y, color):
fig = px.bar(data, x, y, color, orientation='v',width=1000)
fig.update_layout(
plot_bgcolor='white', # clean plot
)
return fig.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment