python - One figure to present multiple pie chart with different size -


enter image description here

the figure above illustration of purpose.

it's easy plot pie chart in matplotlib.

but how draw several pie in 1 figure , size of each figure depend on value set.

any advices or recommandation appreciate!

you can use add_axes adjust size of axes plot. also, there radius parameter in pie function can use specify radius of pie plot. check code below:

labels = 'frogs', 'hogs', 'dogs', 'logs' fracs = [15, 30, 45, 10] fig = plt.figure() ax1 = fig.add_axes([.1, .1, .8, .8], aspect=1) ax1.pie(fracs, labels=labels) ax2 = fig.add_axes([.65, .65, .3, .3], aspect=1)  # can adjust position , size of axes pie plot ax2.pie(fracs, labels=labels, radius=.8)  # radius argument can used adjust size of pie plot plt.show() 

enter image description here


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -