Skip to content

Commit

Permalink
new struct author plot
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Rüdiger Steuer committed Sep 27, 2023
1 parent f150746 commit d85ed12
Showing 1 changed file with 34 additions and 16 deletions.
50 changes: 34 additions & 16 deletions varats/varats/plots/feature_blame_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,14 +298,16 @@ def plot(self, view_mode: bool) -> None:
"num_interacting_features"
]

interacting_with_nd1 = [commit_data[index][0] for index in commit_data.index]
interacting_with_nd1 = [
commit_data[index][0] for index in commit_data.index
]
interacting_with_at_leat_nd2 = [
sum(commit_data[index][1:]) for index in commit_data.index
]
stacked_commit_data = pd.DataFrame(
{
"Min Nesting Degree 1": interacting_with_nd1,
"Min Nesting Degree >=2": interacting_with_at_leat_nd2,
"Min Nesting Degree 1": interacting_with_nd1,
"Min Nesting Degree >=2": interacting_with_at_leat_nd2,
},
index=commit_data.index,
)
Expand All @@ -315,7 +317,10 @@ def plot(self, view_mode: bool) -> None:
nth_ax.set_xlabel("Commits")
nth_ax.set_ylabel("Num Interacting Features")
step = round(len(commit_data) / 6)
nth_ax.set_xticks(ticks=[i*step for i in range(6)], labels=[str(i*step) for i in range(6)])
nth_ax.set_xticks(
ticks=[i * step for i in range(6)],
labels=[str(i * step) for i in range(6)],
)
nth_ax.set_title(case_study.project_name)
case_study_counter += 1

Expand Down Expand Up @@ -798,19 +803,32 @@ def get_stacked_author_data_for_case_studies(
class FeatureAuthorStructDisPlot(Plot, plot_name="feature_author_struct_dis_plot"):

Check failure on line 803 in varats/varats/plots/feature_blame_plots.py

View workflow job for this annotation

GitHub Actions / pylint

[pylint] varats/varats/plots/feature_blame_plots.py#L803 <301>

Line too long (83/80) (line-too-long)
Raw output
varats/varats/plots/feature_blame_plots.py:803:0: C0301: Line too long (83/80) (line-too-long)

Check failure on line 803 in varats/varats/plots/feature_blame_plots.py

View workflow job for this annotation

GitHub Actions / pylint

[pylint] varats/varats/plots/feature_blame_plots.py#L803 <115>

Missing class docstring (missing-class-docstring)
Raw output
varats/varats/plots/feature_blame_plots.py:803:0: C0115: Missing class docstring (missing-class-docstring)

Check warning on line 803 in varats/varats/plots/feature_blame_plots.py

View workflow job for this annotation

GitHub Actions / pylint

[pylint] varats/varats/plots/feature_blame_plots.py#L803 <223>

Method 'calc_missing_revisions' is abstract in class 'Plot' but is not overridden in child class 'FeatureAuthorStructDisPlot' (abstract-method)
Raw output
varats/varats/plots/feature_blame_plots.py:803:0: W0223: Method 'calc_missing_revisions' is abstract in class 'Plot' but is not overridden in child class 'FeatureAuthorStructDisPlot' (abstract-method)
def plot(self, view_mode: bool) -> None:
case_studies: tp.List[CaseStudy] = self.plot_kwargs["case_studies"]
projects_data = [
get_structural_feature_author_data_for_case_study(case_study).loc[
:, "num_implementing_authors"
]
for case_study in case_studies
]
data = get_stacked_author_data_for_case_studies(case_studies, projects_data)

data = data.sort_values(by=["1 Author"])
print(data)
data.set_index("Project").plot(
kind="bar", stacked=True, ylabel="Number of Features Implemented by"
)
fig, axs = pyplot.subplots(ncols=len(case_studies), figsize=(15, 3))

Check warning on line 807 in varats/varats/plots/feature_blame_plots.py

View workflow job for this annotation

GitHub Actions / pylint

[pylint] varats/varats/plots/feature_blame_plots.py#L807 <612>

Unused variable 'fig' (unused-variable)
Raw output
varats/varats/plots/feature_blame_plots.py:807:8: W0612: Unused variable 'fig' (unused-variable)
counter = 0
for ax, case_study in zip(axs, case_studies):
author_data = get_structural_feature_author_data_for_case_study(case_study)

Check failure on line 810 in varats/varats/plots/feature_blame_plots.py

View workflow job for this annotation

GitHub Actions / pylint

[pylint] varats/varats/plots/feature_blame_plots.py#L810 <301>

Line too long (87/80) (line-too-long)
Raw output
varats/varats/plots/feature_blame_plots.py:810:0: C0301: Line too long (87/80) (line-too-long)
author_data = author_data.sort_values(by=["num_implementing_authors"])

Check failure on line 811 in varats/varats/plots/feature_blame_plots.py

View workflow job for this annotation

GitHub Actions / pylint

[pylint] varats/varats/plots/feature_blame_plots.py#L811 <301>

Line too long (82/80) (line-too-long)
Raw output
varats/varats/plots/feature_blame_plots.py:811:0: C0301: Line too long (82/80) (line-too-long)
sns.barplot(
data=author_data,
x="feature",
y="num_implementing_authors",
color="tab:blue",
ax=ax,
)
if counter == 0:
ax.set_xlabel("Features")
ax.set_ylabel("Num Implementing Authors")
else:
ax.set_xlabel("")
ax.set_ylabel("")
x_rng = range(0, len(author_data), 2)
ax.set_xticks(ticks=x_rng, labels=[str(i) for i in x_rng])
max_impl_authors = max(author_data["num_implementing_authors"])

Check failure on line 827 in varats/varats/plots/feature_blame_plots.py

View workflow job for this annotation

GitHub Actions / pylint

[pylint] varats/varats/plots/feature_blame_plots.py#L827 <1136>

Value 'author_data' is unsubscriptable (unsubscriptable-object)
Raw output
varats/varats/plots/feature_blame_plots.py:827:35: E1136: Value 'author_data' is unsubscriptable (unsubscriptable-object)
y_rng = range(1, max_impl_authors + 1)
ax.set_yticks(ticks=y_rng, labels=[str(i) for i in y_rng])
ax.set_title(case_study.project_name)
counter += 1


class FeatureAuthorStructDisPlotGenerator(

Check failure on line 834 in varats/varats/plots/feature_blame_plots.py

View workflow job for this annotation

GitHub Actions / pylint

[pylint] varats/varats/plots/feature_blame_plots.py#L834 <115>

Missing class docstring (missing-class-docstring)
Raw output
varats/varats/plots/feature_blame_plots.py:834:0: C0115: Missing class docstring (missing-class-docstring)
Expand Down

0 comments on commit d85ed12

Please sign in to comment.