1
我想製作一個餡餅圖,但蟒蛇似乎切斷了左側和右側的標籤。有沒有辦法強制顯示所有標籤? 這裏是我做的情節我該如何強制python在餡餅圖中顯示整個標籤
import matplotlib.pyplot as plt
plt.clf()
# get all the groups from the database
tests ...
plt.axes([0.1, 0.1, 0.6, 0.6])
# The slices will be ordered and plotted counter-clockwise.
fracs = [test for test in tests]
labels = ...
explode = [ 0 everywhere ]
plt.pie(fracs, explode=explode, labels=labels, autopct='%1.1f%%', shadow=True, startangle=90)
# Set aspect ratio to be equal so that pie is drawn as a circle.
plt.axis('equal')
plt.title('title', y=1.15)
plt.savefig(store path "_pie.png")
,情節看起來像這樣
沒有人知道如何避免標籤的截止? 謝謝 carl
是的那種工作,但它扭曲了餅圖,使它非圓形...我想有一個選項,只是在左側和右側添加空間來顯示所有文本? – carl