1
import pandas as pd 
import numpy as np 
df = pd.read_csv("Medals.csv")
import matplotlib.pyplot as plt
fig=plt.figure()
plt.suptitle("Medals data")
x = sum(df.Gold)
y = sum(df.Silver)
z = sum(df.Bronze)
y = np.array([x,y,z])
mylabels = ["Gold", "Silver", "Bronze"]
plt.pie(y,labels = mylabels,startangle=0,autopct='%1.1f%%')
plt.axis('equal')
plt.legend(["Gold","Silver","Bronze"],loc ="lower right")
fig.savefig("plot7.png")

This is my code. I want to adjust pie plot inside the same fig size but no i m unable to do so. Kindly help me with this. Also i m new to matplotlib Want result like this Result of my code

I tried to using figsize but it changed the whole figure and also i tried radius but no change in savefig.

Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158

0 Answers0