Skip to content

Commit e91bfe7

Browse files
Refined ie chart
1 parent 0e3feb4 commit e91bfe7

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

src/analysis/analysis.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@ def create_pie_plot():
104104
author_data = read_csv("author_data")
105105

106106
# Initialize Counters
107-
labels = ['Non TDD', 'Rarely TDD', 'Occasionally TDD', 'Somewhat TDD', 'Mostly TDD', 'Consistently TDD']
108-
# 10 25 50 70 90 100
107+
#10 25 50 70 90 100
109108
counters = [0,0,0,0,0,0]
110109

111110

@@ -130,8 +129,19 @@ def create_pie_plot():
130129
# Convert the counters into percentages using a lambda function and map
131130
percentages = list(map(lambda x: x/len(author_data)*100, counters))
132131

132+
labels = ['Non TDD', 'Rarely TDD', 'Occasionally TDD', 'Somewhat TDD', 'Mostly TDD', 'Consistently TDD']
133+
for i in range(len(labels)):
134+
labels[i] = labels[i] + ' - ' + str(round(percentages[i], 0)) + '%'
135+
133136
# Plot the pie chart
134-
plt.pie(percentages, labels=labels)
137+
plt.rcParams["figure.figsize"] = [7.5, 4.25]
138+
plt.rcParams["figure.autolayout"] = True
139+
140+
patches, texts = plt.pie(percentages)
141+
142+
plt.legend(patches, labels, loc="upper left")
143+
plt.axis('equal')
144+
135145
# Show the plot
136146
plt.show()
137147

0 commit comments

Comments
 (0)