I have a dataframe for example the following, where Material, A and B are all column headings:
Material A B
0 Iron 20.30000 5.040409
1 Antimony 0.09200 0.019933
2 Chromium 1.70000 0.237762
3 Copper 8.10000 2.522951
I want to be able to have a 2x2 subplots consisting of bar graphs based on the 4 rows. The heading of each of the 4 subplots would be the material. Each subplot would have two bars for each value of A and B, each bar is in the subplot have a colour associated to A and B. Finally also would be nice to have a legend showing the colour and what it represents i.e. A and B.
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import matplotlib.style as style
sns.set_style("darkgrid")
fig, ax = plt.subplots(2,2)
#Enter for loop
I think a for loop would be the best way to do it, but simply cannot figure out the for loop. Thanks.


