I have two graphs individually and I want to display them on the same plot.
This is my plot 1 code
ax1= concatenated_data_cleaned.groupby(['Cat1', 'Cat2']).median()[['Measure']].unstack()
ax1.plot.bar(rot =0)
plt.xlabel("Cat Names")
plt.ylabel("Measures")
plt.title("Title 1")
plt.show()
This is my plot 2 Code,
ax2= concatenated_data_cleaned.groupby(['Cat2', 'Cat1']).median()[['Measure']].unstack()
ax1.plot.bar(rot =0)
plt.xlabel("Cat Names")
plt.ylabel("Measures")
plt.title("Title 2")
plt.show()
Now, this gets shown in different graph (image) one after another. How Can I show this in the same graph - one below another in the same graph (image).
Kindly help me with this.
This is what I am trying,
fig, axes = plt.subplots(nrows=2)
df1= concatenated_data_cleaned.groupby(['Cat1', 'Cat2']).median()[['Measure']].unstack()
ax1 = df1.plot.bar(rot =0)
df2= concatenated_data_cleaned.groupby(['Cat2', 'Cat1']).median()[['Measure']].unstack()
ax2 = df2.plot.bar(rot =0)
ax1.plt.bar(rot=0, ax=axes[0])
ax2.plt.bar(rot=0, ax=axes[1])
plt.show()
And it is not working for me.