tabnation

python donuts

Aug 8th, 2025
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. # python -m pip install -U pip
  2. # pip install matplotlib
  3.  
  4.  
  5. import matplotlib.pyplot as plt
  6.  
  7. #change these main
  8. labels = ['name 1','name 2','name 3']
  9. sizes = [30, 20, 50] #needs to = 100
  10. colors = ['blue','orange','green']
  11.  
  12. #change these if need
  13. plt.pie(sizes, labels=labels, colors=colors, wedgeprops={'width': 0.4})
  14. centre_circle = plt.Circle((0, 0), 0.65, color='white',
  15. fc='white', linewidth=1.25)
  16. plt.gca().add_artist(centre_circle)
  17.  
  18. plt.axis('equal')
  19.  
  20. plt.title('data chart test')
  21.  
  22.  
  23. plt.savefig("chart.png", dpi=300, bbox_inches='tight')
  24. plt.show()
  25.  
  26.  
  27.  
Advertisement
Add Comment
Please, Sign In to add comment