I have a sample of a dataframe as shown below.
data = {'Date':['2021-07-18','2021-07-19','2021-07-20','2021-07-21','2021-07-22','2021-07-23'],
'Invalid':["NaN", 1, 1, "NaN", "NaN", "NaN"],
'Negative':[23, 24, 17, 24, 20, 23],
'Positive':["NaN", 1, 1, 1, "NaN", 1]}
df_sample = pd.DataFrame(data)
df_sample
The code for displaying a stacked bar graph is given below and also the graph produced by it.
temp = Graph1_df.set_index(['Dates', 'Results']).sort_index(0).unstack()
temp.columns = temp.columns.get_level_values(1)
f, ax = plt.subplots(figsize=(20, 5))
temp.plot.bar(ax=ax, stacked=True, width = 0.3, color=['blue','green','red'])
ax.title.set_text('Total Test Count vs Dates')
plt.show()
Using the code above or with any new approach, I want just the values for 'positive' to be displayed on the chart. Note: 3rd column in the dataframe snippet is the 'Positive' column.
Any help is greatly appreciated. Thanks.