I'm writing a script to generate multiple graphs using different csv files. When the second pie chart is created, it has the percentage values from the first pie chart. As shown in the below image:
This is my code:
## Chart1
df = pd.read_csv('list1.csv')
piechart = df.groupby('ABC')['Policy'].nunique()
ax1 = plt.subplot(111, aspect='equal')
piechart.plot(kind='pie', ax=ax1, autopct='%1.f%%',
startangle=90, shadow=False, legend = False, fontsize=8, title="Policy Chart 1")
plt.savefig('img1.png', dpi=100)
#Chart2
df1 = pd.read_csv('list2.csv')
piechart2 = df1.groupby('ABC')['Policy'].nunique()
ax2 = plt.subplot(111, aspect='equal')
piechart2.plot(kind='pie', ax=ax2, autopct='%1.f%%',startangle=90, shadow=False, legend = False, fontsize=8, title="Policy chart")
plt.savefig('img2.png', dpi=100)
Here the chart2 has both values and labels from chart1. How do I avoid this.
Also, I have another bar graph saved as pic1 "plt.savefig("pic1", dpi= 100)", how do i save above img1.png and pic.png in one image. (Like Bar grapgh to the left and piechart to right in one picture).
Thanks in advance!