How to draw a 'Death Star' pie chart using matplotlib

In the midst of redoing my Star Wars project, I’ve started working more on the style of charts. Had an idea of modifying pie-chart into a death star, at this stage it wasn’t that hard:

fig, ax1 = plt.subplots()
fig.patch.set_facecolor('black')
fig.suptitle('Are you a fan?', family='SF Distant Galaxy', fontsize=22, color="#FFE81F",  x=0.6)

# main pie chart:
patches, texts, autotexts = ax1.pie(sizes, labels=labels, autopct='%1.0f%%', pctdistance=0.7, colors=colors, 
                           textprops=textprops, wedgeprops={'edgecolor' :'black' }, startangle=88)
ax1.set_title('long time ago in a galaxy far away...', color='#4BD5EE', x=0.65)
for el in texts:
    el.set_fontsize(14)
    el.set_color('#4BD5EE')

# DEATH STAR MOD:
# plotting a list to draw the bigger inner circle with slices:
for_empire = [1,1,1,1,1,1,1,1,1,1]
plt.pie(for_empire, radius=0.35, startangle=90, wedgeprops={'edgecolor' :'black', 'fc':'#a9a2a4'}, 
        center=(-0.45,0.3))
# drawing a small circle inside it:
death_star2 = plt.Circle((-0.45,0.3), 0.1, ec='black', fc='#a9a2a4')
fig = plt.gcf()
fig.gca().add_artist(death_star2)    
plt.show()

death_star

I’m curious how can I keep going on improving the death star using matplotlib. I suspect the tools are out there, maybe someone can guide me:

  • how to flatten the “death star circle” - maybe it’s going to make it look a bit more realistic
  • shifting the color to a darker one, closer to an edge? (to make it look more spherical?)
  • adding random white points in the background?
    PS yeah, I know the readability drops a bit , but who cares, it’s a death star!
1 Like