<jupyter_start><jupyter_text>Pie Chart<jupyter_code># Recover default matplotlib settings
mpl.rcParams.update(mpl.rcParamsDefault)
%matplotlib inline
plt.style.use('seaborn-darkgrid')
plt.figure(figsize=(9,9))
area = [48,30,20,15]
labels =['Low', 'Medium','High','Critical']
colors = ['#8BC34A','#D4E157','#FFB300','#FF7043']
plt.pie(area,labels=labels, colors=colors, startangle=45)
# Display percentage in Pie Chart using autopct='%1.1f%%'
plt.figure(figsize=(8,8))
area = [48 , 30 , 20 , 15]
labels = ['Low' , 'Medium' , 'High' , 'Critical']
colors = ['#7CB342','#C0CA33','#FFB300','#F57C00']
plt.pie (area , labels= labels , colors= colors , startangle=45 , shadow='true',autopct='%1.1f%%')
plt.show()
plt.figure(figsize=(8,8))
area = [48 , 30 , 20 , 15]
total = np.sum(area)
labels = ['Low' , 'Medium' , 'High' , 'Critical']
def val_per(x):
 return '{:.2f}%\n({:.0f})'.format(x, total*x/100)
colors = ['#7CB342','#C0CA33','#FFB300','#F57C00']
plt.pie (area , labels= labels , colors= colors , startangle=45 , shadow='true',autopct=val_per)
plt.show()
#Explode 4th Slice
plt.figure(figsize=(8,8))
area = [48 , 30 , 20 , 15]
labels = ['Low' , 'Medium' , 'High' , 'Critical']
colors = ['#7CB342','#C0CA33','#FFB300','#F57C00']
# explode = [0,0,0,0.1] will explode the fourth slice
plt.pie (area , labels= labels , colors= colors , startangle=45 , autopct='%1.1f%%' , shadow='true',explode=[0,0,0,0.1])
plt.show()
#Explode 3rd & 4th Slice
plt.figure(figsize=(8,8))
area = [48 , 30 , 20 , 15]
label = ['Low' , 'Medium' , 'High' , 'Critical']
color = ['#7CB342','#C0CA33','#FFB300','#F57C00']
# explode = [0,0,0.1,0.1] will explode the 3rd & 4th slice
plt.pie (area , labels= label , colors= color , startangle=45 ,autopct='%1.1f%%', shadow='true',explode=[0,0,0.1,0.1])
plt.legend()
plt.show()<jupyter_output><empty_output><jupyter_text>Dount Plot<jupyter_code>plt.figure(figsize=(9,9))
area = [48 , 30 , 20 , 15]
labels = ['Low' , 'Medium' , 'High' , 'Critical']
colors = ['#8BC34A','#D4E157','#FFB300','#FF7043']
plt.pie (area , labels= labels , colors= colors , startangle=45)
my_circle=plt.Circle( (0,0), 0.7, color='white') # Adding circle at the centre
p=plt.gcf()
p.gca().add_artist(my_circle)
plt.show()
#Explode Slice in Donut Chart
plt.figure(figsize=(9,9))
area = [48 , 30 , 20 , 15]
labels = ['Low' , 'Medium' , 'High' , 'Critical']
colors = ['#8BC34A','#D4E157','#FFB300','#FF7043']
plt.pie (area , labels= labels , colors= colors , startangle=45 , explode=[0,0 , 0.0 , 0.1])
my_circle=plt.Circle( (0,0), 0.7, color='white') # Adding circle at the centre
p=plt.gcf()
p.gca().add_artist(my_circle)
plt.show()
plt.figure(figsize=(9,9))
area = [48 , 30 , 20 , 15]
labels = ['Low' , 'Medium' , 'High' , 'Critical']
colors = ['#8BC34A','#D4E157','#FFB300','#FF7043']
plt.pie (area , labels= labels , colors= colors , startangle=45 , explode=[0,0 , 0.1 , 0.1])
my_circle=plt.Circle( (0,0), 0.7, color='white') # Adding circle at the centre
p=plt.gcf()
p.gca().add_artist(my_circle)
plt.show()
fig = plt.figure(figsize=(20,6))
area = [48 , 30 , 20 , 15]
priority = ['Low' , 'Medium' , 'High' , 'Critical']
status = ['Resolved' , 'Cancelled' , 'Pending' , 'Assigned']
company = ['IBM' , 'Microsoft', 'BMC' , 'Apple']
colors = ['#8BC34A','#D4E157','#FFB300','#FF7043']
plt.subplot(1,3,1)
plt.pie (area , labels= priority , colors= colors , startangle=45)
my_circle=plt.Circle( (0,0), 0.7, color='white') # Adding circle at the centre
p=plt.gcf()
p.gca().add_artist(my_circle)
plt.subplot(1,3,2)
plt.pie (area , labels= status , colors= colors , startangle=45)
my_circle=plt.Circle( (0,0), 0.7, color='white') # Adding circle at the centre
p=plt.gcf()
p.gca().add_artist(my_circle)
plt.subplot(1,3,3)
plt.pie (area , labels= company , colors= colors , startangle=45)
my_circle=plt.Circle( (0,0), 0.7, color='white') # Adding circle at the centre
p=plt.gcf()
p.gca().add_artist(my_circle)
plt.show()
fig = plt.figure(figsize=(20,13))
area = [48 , 30 , 20 , 15]
priority = ['Low' , 'Medium' , 'High' , 'Critical']
status = ['Resolved' , 'Cancelled' , 'Pending' , 'Assigned']
company = ['IBM' , 'Microsoft', 'BMC' , 'Apple']
colors = ['#8BC34A','#D4E157','#FFB300','#FF7043']
plt.subplot(2,3,1)
plt.pie (area , labels= priority , colors= colors , startangle=45)
my_circle=plt.Circle( (0,0), 0.7, color='white') # Adding circle at the centre
p=plt.gcf()
p.gca().add_artist(my_circle)
plt.subplot(2,3,2)
plt.pie (area , labels= status , colors= colors , startangle=45)
my_circle=plt.Circle( (0,0), 0.7, color='white') # Adding circle at the centre
p=plt.gcf()
p.gca().add_artist(my_circle)
plt.subplot(2,3,3)
plt.pie (area , labels= company , colors= colors , startangle=45)
my_circle=plt.Circle( (0,0), 0.7, color='white') # Adding circle at the centre
p=plt.gcf()
p.gca().add_artist(my_circle)
plt.subplot(2,3,4)
plt.pie (area , labels= priority , colors= colors , startangle=45)
my_circle=plt.Circle( (0,0), 0.7, color='white') # Adding circle at the centre
p=plt.gcf()
p.gca().add_artist(my_circle)
plt.subplot(2,3,5)
plt.pie (area , labels= status , colors= colors , startangle=45)
my_circle=plt.Circle( (0,0), 0.7, color='white') # Adding circle at the centre
p=plt.gcf()
p.gca().add_artist(my_circle)
plt.subplot(2,3,6)
plt.pie (area , labels= company , colors= colors , startangle=45)
my_circle=plt.Circle( (0,0), 0.7, color='white') # Adding circle at the centre
p=plt.gcf()
p.gca().add_artist(my_circle)
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.21826852531181218, 'fraction_numerical': 0.07410124724871607, 'mean_word_length': 5.93765903307888, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '342633', 'license': 'MIT', 'n_tokens_mistral': 2546, 'n_tokens_neox': 2244, 'n_words': 476, 'path': 'ScatterGraphAndPieDount.ipynb', 'repo_name': 'uannabi/MatPlotLibGraph', 'size': '5452'}