Skip to content

Instantly share code, notes, and snippets.

@yassineAlouini
Created November 18, 2018 12:03
Show Gist options
  • Save yassineAlouini/a59440797859fcbc2440ff9c23de6eef to your computer and use it in GitHub Desktop.
Save yassineAlouini/a59440797859fcbc2440ff9c23de6eef to your computer and use it in GitHub Desktop.
Bar plot of the break down of my deep learning box
import pandas as pd
import matplotlib.pylab as plt
import seaborn as sns
# In the clipboard
# piece,price
# gpu,869
# ssd,140
# power,113
# cooling,60
# cpu,317
# ram,200
# motherboard,200
# hard_drive,93
# case,110
sns.set(font_scale=2)
deep_meaning_df = pd.read_clipboard(sep=',')
deep_meaning_df['fraction'] = 100 * deep_meaning_df['price'] / deep_meaning_df['price'].sum()
ax = deep_meaning_df.sort_values('fraction').plot(y='fraction', x='piece', kind='barh')
ax.set_xlabel("% of total budget")
ax.set_ylabel("Piece type")
ax.set_title("Deep meaning's budget breakdown")
plt.savefig('path/to/img.png')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment