I have a data frame that held 4 entries: Year, Location, Functional Groups (FG), and the Area of those groups. The data isn't arranged like the follow image, is just for clarification.
So, I'm struggling to make a bar plot with those 4 variables. I need to represent at the same time, the area occupied by each Functional Group at different locations and at different years.
My best attempt so far was:
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
df = pd.read_csv('Data.csv')
ax = df.set_index('Grupos Funcionais').T.plot.bar(stacked=True, rot=0, cmap='tab20', figsize=(10, 7))
ax.legend(bbox_to_anchor=(1.01, 1.02), loc='upper left')
plt.tight_layout()
plt.show()
This code was taken from a previous question made here at SOF. It is a "readable" graphic, but my goal is to create a stacked bar graph, with the following idea:
Any idea would be very very helpful, I've been struggling a lot with this for almost a week so.