python - One figure to present multiple pie chart with different size -
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()
Comments
Post a Comment