Created
March 12, 2020 17:34
-
-
Save aniruddha27/6c18b332a0873579340bc65f2002e200 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#dictionary for meals per food item | |
item_count = {} | |
for i in range(table.index.nunique()): | |
item_count[table.index[i]] = table.num_orders[i]/df_meal[df_meal['category']==table.index[i]].shape[0] | |
#bar plot | |
plt.bar([x for x in item_count.keys()],[x for x in item_count.values()],color='orange') | |
#adjust xticks | |
plt.xticks(rotation=70) | |
#label x-axis | |
plt.xlabel('Food item') | |
#label y-axis | |
plt.ylabel('No. of meals') | |
#label the plot | |
plt.title('Meals per food item') | |
#save plot | |
plt.savefig('C:\\Users\\Dell\\Desktop\\AV Plotting images\\matplotlib_plotting_7.png',dpi=300,bbox_inches='tight') | |
#display plot | |
plt.show(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment