This commit is contained in:
wea_ondara
2020-04-11 14:07:57 +02:00
parent 4195c83ef8
commit 06085870a1
6 changed files with 66 additions and 33 deletions

View File

@@ -8,7 +8,7 @@ from math import ceil
import matplotlib.pyplot as plt
import numpy as np
from common import calc_intervals, imprt, printnoln, rprint, DAYS_NEW_USER, IMAGE_MAGICK
from common import calc_intervals, imprt, printnoln, rprint, DAYS_NEW_USER, IMAGE_MAGICK, FIG_SIZE
from loader import load, dmt, cms
OLD_USER_PERCENTILE = 0.95
@@ -85,7 +85,7 @@ def main(folder, intervl):
avgnewpos.append(np.average(pos))
avgnewall.append(np.average([item['compound'] for item in toxlevels]))
fig, axs = plt.subplots(figsize=(16, 12))
fig, axs = plt.subplots(figsize=FIG_SIZE)
axs.boxplot([neg, neu, pos])
axs.set_xticklabels(['negative', 'neutral', 'positive'])
axs.set_title("Sentiment categorization of answers to posts within 1 week of 1st contribution\nPosts created between "
@@ -126,7 +126,7 @@ def main(folder, intervl):
avgoldpos.append(np.average(pos))
avgoldall.append(np.average([item['compound'] for item in toxlevels]))
fig, axs = plt.subplots(figsize=(16, 12))
fig, axs = plt.subplots(figsize=FIG_SIZE)
axs.boxplot([neg, neu, pos])
axs.set_xticklabels(['negative', 'neutral', 'positive'])
axs.set_title("Sentiment categorization of answers to posts within 1 week of 1st contribution\nPosts created between "
@@ -142,7 +142,7 @@ def main(folder, intervl):
os.system(magickold + " " + outputdir + "boxsent_oldusers.pdf")
# plot new users
fig = plt.figure(figsize=(16, 12))
fig = plt.figure(figsize=FIG_SIZE)
x = [f.strftime("%d-%m-%Y") + " - " + t.strftime("%d-%m-%Y") for (f, t) in intervals]
plt.plot(x, avgnewneg, label='negative')
plt.plot(x, avgnewneu, label='neutral')
@@ -155,7 +155,7 @@ def main(folder, intervl):
plt.close(fig)
# plot old users
fig = plt.figure(figsize=(16, 12))
fig = plt.figure(figsize=FIG_SIZE)
x = [f.strftime("%d-%m-%Y") + " - " + t.strftime("%d-%m-%Y") for (f, t) in intervals]
plt.plot(x, avgoldneg, label='negative')
plt.plot(x, avgoldneu, label='neutral')