简体   繁体   中英

I am trying to plot Donut pie chart using matplotlib, but the inner circle and out pie circle doesn't seem like to start at the center

using this code to generate pie chart

df.STATUS.value_counts(sort=True).plot.pie(colors = colors, center=(0,0),explode = explode, autopct='%1.1f%%', pctdistance=0.85)
#draw circle
centre_circle = plt.Circle((0,0),0.95,fc='black')

Output:

甜甜圈饼图

You can try plotting a fake pie as following:

ax = df.STATUS.value_counts(sort=True).plot.pie(colors = colors, center=(0,0),explode = explode, autopct='%1.1f%%', pctdistance=0.85)
ax.pie([1], colors='k', radius=0.5);

which creates something like this:

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM