Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Donut chart graphing funciton

def pie_chart_single(labels, sizes, colors):

  textprops = {"fontsize":16}
  wedgeprops = {'linewidth': 4, "edgecolor": "w"} #creates white lines around each wedge

  plt.pie(sizes, colors = colors, labels = labels, autopct = '%1.1f%%', #display numbers to 1 decimal point
        startangle=90, pctdistance = 0.5, textprops = textprops, wedgeprops = wedgeprops)
  
  centre_circle = plt.Circle((0,0),0.6,fc='white')  #draw white circle at center to create donut chart
  plt.gcf().gca().add_artist(centre_circle)  #gcf: get current figure, gca: get current axis
  
  plt.axis('equal')  # Equal aspect ratio ensures that pie is drawn as a circle
  plt.tight_layout()
  plt.show()
Comment

PREVIOUS NEXT
Code Example
Python :: Horizontal stacked percent bar chart - with dataframe, seaborn colormap 
Python :: insert key in binary tree recursively 
Python :: upload file to SQL server pyodbc python 
Python :: create horizontal descriptives table pandas 
Python :: Open a web browser in Python 
Python :: windows py SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate 
Python :: django Account has no customer 
Python :: 5.2.5: Counting 10 to 100 by ... 
Python :: huffepuf 
Python :: python script to recursively scan subdirectories 
Python :: tkinter radiobutton "bind_all" 
Python :: file attributes in os 
Python :: copy data with tensroflow io 
Python :: django model meta ordering multiple ordering 
Python :: python get text between two points 
Python :: function used in python 
Python :: Character in function python 3 
Python :: does python have a end of line symbol 
Python :: def f(x) python 
Python :: openpyxl add_filter column 
Python :: python creare decoratori 
Python :: Returns the cartesian product with another DataFrame 
Python :: integer to boolean numpy 
Python :: addinput() python 
Python :: discord.py find channel by id 
Python :: pandas remove rows based on DATETIME column year 
Python :: I want only the span of finditer in re python 
Python :: os get directory from string 
Python :: identifiers in pyhton 
Python :: colorbar remove tick lines and border 
ADD CONTENT
Topic
Content
Source link
Name
1+4 =