我做的是一个完美的圆形饼图,然后我在中间加一个白色的圆圈,这样看起来像狗狗。在
最后,我在图的中间添加了一个图像,从我发现的一个例子中,它将完美圆的大小调整为一个省略。在
图片:
代码:> labels = df.index.values
>sizes = (1, 1, 1, 1,1, 1, 1, 1,1, 1, 1, 1,1, 1, 1, 1,1, 1, 1, 1,1, 1, 1, 1,1, 1, 1, 1,1,1)
>
> DonutA = plt.pie(sizes, colors=df.ColorCond.map({True :'g', False :
> 'r'}), shadow=False,
> wedgeprops = { 'linewidth' : 1 , 'edgecolor' : 'lightgrey'}, radius=1)
>
> #draw a circle at the center of pie to make it look like a donut centre_circle = plt.Circle((0,0),0.75,color='white',
> fc='white',linewidth=1) fig = plt.gcf()
> fig.gca().add_artist(centre_circle) im =
> plt.imread(get_sample_data('C:\\Users\\Usuario\\Desktop\\Sanmatech\\A2.png'))
> newax = fig.add_axes([0.33,0.36,0.37,0.30], anchor='SE', zorder=1)
> newax.imshow(im, extent=(30, 50, 30, 50)) plt.axis('equal')
> newax.axis('off')
>
> # Set aspect ratio to be equal so that pie is drawn as a circle.
>
> plt.show()
真的有点纠结于此,我已经明确了它的底线:
^{pr2}$
但是已经玩了几天没有运气了: