I have set of data with 3 columns Label, Year and Total. My total count is based on the group of label and year.
-------------------- ------- -------
| Label| Year| Total|
-------------------- ------- -------
| FTP|02/2018| 193360|
| BBBB |01/1970| 14|
| BBBB |02/2018|4567511|
| SSSS|02/2018| 187589|
| Dddd|02/2018| 41508|
I want to plot the data like in this below image. How to achieve this with stacked area chart in Pandas python. ( my x-axis should have both my label and year values and based on that grouping of y-axis should plot values )
The code I tried with seaborn as well normal
dF.plot(figsize=(20,8), x =['Label','Year'], y ='Total', kind = 'area', stacked = True)
ax = df.plot(x="label", y="Total", legend=False, figsize=(10,8))
ax2 = ax.twinx()
df.plot(x="label", y="Dst_Port", ax=ax2, legend=False, color="r", figsize=(10,8))
ax.figure.legend()
plt.show()
My current graph can plot with single x-axis column value.
CodePudding user response: