2
The figure is cutting the captions, how do I fix it?
# Libraries
import matplotlib.pyplot as plt
# Make data
group_names=['0,89% - Tração Animal e Propulsão Humana',
'45,08% - Passageiro e Misto',
'2,77% - Não Identificado',
'2,24% - Coletivos',
'12,76% - Motos e Similares',
'0,07% - Tratores',
'25,13% - Caminhões',
'0,05% - Carga independente',
'11,01% - Carga e Misto']
group_size=[ 211, 10747,661, 535, 3041, 16, 5990, 13, 2626]
# Create colors
a, b,c,d,e,f,g,h,i =[plt.cm.YlOrRd, plt.cm.YlOrRd, plt.cm.YlOrRd, plt.cm.YlOrRd, plt.cm.YlOrRd,
plt.cm.YlOrRd, plt.cm.YlOrRd, plt.cm.YlOrRd, plt.cm.YlOrRd,]
# First Ring (outside)
fig, ax = plt.subplots()
ax.axis('equal')
mypie, _ = ax.pie(group_size, radius=1.3, labels=group_names, colors=[a(0.3), b(0.9), c(0.5), d(0.4), e(0.7),
f(0.2), g(0.8), h(0.1), i(0.6)] )
plt.setp(mypie, width=0.5, edgecolor='white')
#plt.legend(loc=(1.0,0.2))
plt.savefig('meuGrafico.png', dpi=300)
# show it
plt.show()
Again thank you boy.
– Thiago Fernandes