Skip to content

Commit 41d9697

Browse files
Corrected and Refined Labelling and changed the order of plot for better viewing
1 parent ac7a629 commit 41d9697

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

src/analysis/analysis.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ def create_size_impact_plot():
3535
plt.plot(x, a * x + b, color="red", alpha=0.5)
3636

3737
# Set title and axes labels
38-
plt.xlabel("Commit Count")
38+
plt.xlabel("Repo Size (No. of files)")
3939
plt.ylabel("Percentage of TDD")
40-
plt.title("Scatter plot showing how the size of commits impacts results")
40+
plt.title("Repo size and TDD percentage")
4141

4242
# Show the plot
4343
plt.show()
@@ -50,8 +50,8 @@ def create_box_plot():
5050

5151
# Initialize arrays to store percentages for each repo
5252
before = []
53-
during = []
5453
after = []
54+
during = []
5555

5656
# Iterate through each repo and append the before, during and after percentages to each array
5757
for repo in repo_data:
@@ -60,19 +60,19 @@ def create_box_plot():
6060

6161
# Append the percentage data to each array
6262
before.append((int(repo['Test Before']) / total_test_count) * 100)
63-
during.append((int(repo['Test During']) / total_test_count) * 100)
6463
after.append((int(repo['Test After']) / total_test_count) * 100)
64+
during.append((int(repo['Test During']) / total_test_count) * 100)
6565

6666
# Plot the box plots
67-
boxplt = plt.boxplot([before, during, after], patch_artist=True, tick_labels=["Before", "During", "After"], flierprops= dict(markerfacecolor='coral'))
67+
boxplt = plt.boxplot([before, after, during], patch_artist=True, tick_labels=["Before", "After", "During"], flierprops= dict(markerfacecolor='coral'))
6868

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

7373
# Set title and axes labels
7474
plt.ylabel("Percentage")
75-
plt.title("Boxplot showing how often a test is created\nbefore, during and after implementation")
75+
plt.title("How often a test is created before, after and during implementation")
7676

7777
# Show the plot
7878
plt.show()
@@ -84,23 +84,22 @@ def create_avg_commit_size_plot():
8484

8585
# Initialize variables to store averages for each repo
8686
before_avg = 0
87-
during_avg = 0
8887
after_avg = 0
88+
during_avg = 0
8989

9090
# Iterate through each repo and update the before, during and after averages
9191
for repo in repo_data:
9292
before_avg = (before_avg + float(repo['Avg Before Commit Size'])) / 2
93-
during_avg = (during_avg + float(repo['Avg During Commit Size'])) / 2
9493
after_avg = (after_avg + float(repo['Avg After Commit Size'])) / 2
94+
during_avg = (during_avg + float(repo['Avg During Commit Size'])) / 2
9595

9696
# Plot the bar chart
9797
colors = ['palegreen', 'lightblue', 'lightskyblue']
98-
plt.bar(["Before", "During", "After"], [before_avg, during_avg, after_avg], align='center', color=colors)
98+
plt.bar(["Before", "After", "During"], [before_avg, after_avg, during_avg], align='center', color=colors)
9999

100100
# Set title and axes labels
101-
plt.xlabel("Commit relation between tests and implementation")
102101
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")
102+
plt.title("Average commit size when tests are created \nbefore, after and during implementation")
104103

105104
# Show the plot
106105
plt.show()
@@ -147,7 +146,7 @@ def create_pie_plot():
147146
patches, texts = plt.pie(percentages, colors=colours)
148147
plt.legend(patches, labels, loc="upper left")
149148
plt.axis('equal')
150-
plt.title("Pie chart showing the percentage of authors using levels of TDD")
149+
plt.title("Percentage of authors using levels of TDD")
151150

152151
# Show the plot
153152
plt.show()

0 commit comments

Comments
 (0)