I am trying to draw a pie chart using python matplotlib
. How to position the legend and pie chart so they are not overlapping each other. My code is as below:
import matplotlib.pyplot as plt
import numpy as np
y = np.array([1,117,11,5])
mylabels ="Complete","Pass","Fail","Block"
mycolors = ["b","g","r","c"]
myexplode =[0.6,0,0.4,0]
plt.pie(y,labels=mylabels,explode = myexplode,shadow=True,colors = mycolors,autopct
='%1.1f%%')
plt.legend(title ="Test result types")
plt.show()