This can be achieved with matplotlib
from import ConnectionPatch #make canvas fig = (figsize=(9,5.0625)) ax1 = fig.add_subplot(121) ax2 = fig.add_subplot(122) fig.subplots_adjust(wspace=0) #Big Pie Chart Creation labels = size = explode=(0,0,0,0,0,0.1) (size, autopct='%1.1f%%',startangle=30,labels=labels,explode=explode) #Small Pie Chart Creation labels2 = size2 = width=0.2 (size2, autopct='%1.1f%%',startangle=90,labels=labels2, radius=0.5,shadow=True) # Use ConnectionPatch to draw a line between two pie charts # Get the data from the edge of the pie chart first theta1, theta2 = [5].theta1, [5].theta2 center, r = [5].center,[5].r # Draw a line connecting the upper edges x = r*(/180*theta2)+center[0] y = (/180*theta2)+center[1] con = ConnectionPatch(xyA=(-width/2,0.5),xyB=(x,y), coordsA='data', coordsB='data',axesA=ax2,axesB=ax1) con.set_linewidth(2) con.set_color=([0,0,0]) ax2.add_artist(con) # Draw a line connecting the lower edges x = r*(/180*theta1)+center[0] y = (/180*theta1)+center[1] con = ConnectionPatch(xyA=(-width/2,-0.5),xyB=(x,y), coordsA='data', coordsB='data',axesA=ax2,axesB=ax1) con.set_linewidth(2) con.set_color=([0,0,0]) ax2.add_artist(con)
()
Output:
Chart source data are fast food restaurant sales
summarize
The above is a small introduction to python through matplotlib to achieve the generation of composite pie charts, I hope to help you!