Skip to content

Commit ac7a629

Browse files
Made more refinements
1 parent e91bfe7 commit ac7a629

1 file changed

Lines changed: 16 additions & 15 deletions

File tree

src/analysis/analysis.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def create_box_plot():
6666
# Plot the box plots
6767
boxplt = plt.boxplot([before, during, after], patch_artist=True, tick_labels=["Before", "During", "After"], flierprops= dict(markerfacecolor='coral'))
6868

69-
colors = ['lightskyblue', 'paleturquoise', 'palegreen']
69+
colors = ['palegreen', 'lightblue', 'lightskyblue']
7070
for patch, color in zip(boxplt['boxes'], colors):
7171
patch.set_facecolor(color)
7272

@@ -94,7 +94,14 @@ def create_avg_commit_size_plot():
9494
after_avg = (after_avg + float(repo['Avg After Commit Size'])) / 2
9595

9696
# Plot the bar chart
97-
plt.bar(["Before", "During", "After"], [before_avg, during_avg, after_avg], align='center')
97+
colors = ['palegreen', 'lightblue', 'lightskyblue']
98+
plt.bar(["Before", "During", "After"], [before_avg, during_avg, after_avg], align='center', color=colors)
99+
100+
# Set title and axes labels
101+
plt.xlabel("Commit relation between tests and implementation")
102+
plt.ylabel("Average Commit Size (No. of files)")
103+
plt.title("Bar chart showing the average commit size when a\ntests are created before, during and after implementation")
104+
98105
# Show the plot
99106
plt.show()
100107

@@ -133,27 +140,21 @@ def create_pie_plot():
133140
for i in range(len(labels)):
134141
labels[i] = labels[i] + ' - ' + str(round(percentages[i], 0)) + '%'
135142

136-
# Plot the pie chart
143+
# Set up and plot the pie chart, colors, legend and title
144+
colours = ['#225ea8', '#1d91c0', '#41b6c4', '#7fcdbb', '#c7e9b4', '#71cb71']
137145
plt.rcParams["figure.figsize"] = [7.5, 4.25]
138146
plt.rcParams["figure.autolayout"] = True
139-
140-
patches, texts = plt.pie(percentages)
141-
147+
patches, texts = plt.pie(percentages, colors=colours)
142148
plt.legend(patches, labels, loc="upper left")
143149
plt.axis('equal')
150+
plt.title("Pie chart showing the percentage of authors using levels of TDD")
144151

145152
# Show the plot
146153
plt.show()
147154

148-
#create_size_impact_plot()
149-
#create_box_plot()
150-
#create_avg_commit_size_plot()
155+
create_size_impact_plot()
156+
create_box_plot()
157+
create_avg_commit_size_plot()
151158
create_pie_plot()
152159

153-
'''
154-
155-
8. How does TDD adoption vary between projects?
156-
157-
'''
158-
159160

0 commit comments

Comments
 (0)