master-thesis/util/discussion.py
2021-08-20 12:22:04 +02:00

30 lines
945 B
Python
Executable File

import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from scipy.stats import pearsonr
if __name__ == '__main__':
data = pd.read_csv('commit_analysis.csv')
data['type'] = data['is_ml'].apply(lambda x: 'ML' if x else 'No ML')
ylim = data['n_comments'].quantile(0.97)
sns.catplot(x='type', y='n_comments', kind='box', data=data) \
.set(title='Commenti in base al tipo di issue') \
.set(xlabel='tipo') \
.set(ylabel='numero di commenti') \
.set(ylim=(0, ylim))
plt.tight_layout()
plt.savefig('../src/figures/comments.pdf')
plt.close()
ylim = data['words_mean'].quantile(0.97)
sns.catplot(x='type', y='words_mean', kind='box', data=data) \
.set(title='Parole medie in un commento') \
.set(xlabel='tipo') \
.set(ylabel='parole medie') \
.set(ylim=(0, ylim))
plt.tight_layout()
plt.savefig('../src/figures/words.pdf')