This is related to post Rolling Difference using Pandas
Now that I have this dataframe below, i am trying to visualize this.
Item Add Subtracts Month Net_Items Monthly_Available_Items
C 68 30 1 38 38
C 58 34 2 24 62
C 64 47 3 17 79
C 263 81 4 182 261
C 95 104 5 -9 252
C 38 63 6 -25 227
C 115 95 7 20 247
C 97 112 8 -15 232
The code and graph are below:
plt.figure(figsize=(20,10))
fig, ax1 = plt.subplots(figsize = (20,10))
ax1 = sns.pointplot(x='Month', y='value', hue='variable',data=stack_df)
ax1.legend(loc = 'upper left')
ax2 = sns.barplot(x = 'Month', y = 'Monthly_Available_Items', data =
stack_df, color = 'purple')
ax1.set_ylabel("Count of Items")
Comparison of Add and subtracts vs available monthly inventory:
Questions:
How can i add the legend to the ax2 axis. This represent the Monthly Available items for each month. i tried
ax2.legend() but it not work
How can i create similar plots for each item(A,B,C,D,E)