improved chart style
This commit is contained in:
parent
a878d142bd
commit
9967f1dff7
21 changed files with 134 additions and 54 deletions
|
@ -1,7 +1,7 @@
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from tools.statistics import extract
|
from tools.statistics import extract, ressource
|
||||||
|
|
||||||
|
|
||||||
def analyse(datas: list[dict]) -> plt.Figure:
|
def analyse(datas: list[dict]) -> plt.Figure:
|
||||||
|
@ -10,10 +10,12 @@ def analyse(datas: list[dict]) -> plt.Figure:
|
||||||
# prepare plotting
|
# prepare plotting
|
||||||
figure: plt.Figure = plt.figure()
|
figure: plt.Figure = plt.figure()
|
||||||
axes = figure.add_subplot(1, 1, 1)
|
axes = figure.add_subplot(1, 1, 1)
|
||||||
axes.set_title("Nombre de personne par âge")
|
axes.set_title("Âge des personnes sondées")
|
||||||
|
|
||||||
# bar chart
|
# bar chart
|
||||||
bins = np.arange(min(x), max(x), 1)
|
bins = np.arange(min(x), max(x), 1)
|
||||||
axes.hist(x, bins=bins, edgecolor='black')
|
axes.hist(x, bins=bins, edgecolor='black')
|
||||||
|
axes.set_xlabel("Âge")
|
||||||
|
axes.set_ylabel("Quantité")
|
||||||
|
|
||||||
return figure
|
return figure
|
||||||
|
|
|
@ -36,5 +36,7 @@ def analyse(datas: list[dict]) -> plt.Figure:
|
||||||
# bar chart
|
# bar chart
|
||||||
bins = np.arange(min(x), max(x), 1)
|
bins = np.arange(min(x), max(x), 1)
|
||||||
axes.hist(x, bins, weights=y, edgecolor="black")
|
axes.hist(x, bins, weights=y, edgecolor="black")
|
||||||
|
axes.set_xlabel("Âge")
|
||||||
|
axes.set_ylabel("Complétion")
|
||||||
|
|
||||||
return figure
|
return figure
|
||||||
|
|
|
@ -29,9 +29,13 @@ def analyse(datas: list[dict]) -> plt.Figure:
|
||||||
# prepare plotting
|
# prepare plotting
|
||||||
figure: plt.Figure = plt.figure()
|
figure: plt.Figure = plt.figure()
|
||||||
axes = figure.add_subplot(1, 1, 1)
|
axes = figure.add_subplot(1, 1, 1)
|
||||||
axes.set_title("Nombre moyen de mission complété par expérience")
|
axes.set_title("Nombre moyen de mission complété par opinion")
|
||||||
|
|
||||||
# bar chart
|
# bar chart
|
||||||
axes.bar(x, y, edgecolor='black')
|
axes.bar(x, y, color=ressource.experience.colors, edgecolor='black')
|
||||||
|
axes.set_xticks(x)
|
||||||
|
axes.set_xticklabels(ressource.experience.labels)
|
||||||
|
axes.set_xlabel("Expérience")
|
||||||
|
axes.set_ylabel("Complétion")
|
||||||
|
|
||||||
return figure
|
return figure
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
from collections import defaultdict
|
|
||||||
|
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from tools.statistics import extract
|
from tools.statistics import extract, ressource
|
||||||
|
|
||||||
|
|
||||||
def analyse(datas: list[dict]) -> plt.Figure:
|
def analyse(datas: list[dict]) -> plt.Figure:
|
||||||
languages_completion: dict[str, int] = defaultdict(lambda: 0)
|
languages_completion: dict[str, int] = dict.fromkeys(ressource.language.choices, 0)
|
||||||
languages_count: dict[str, int] = defaultdict(lambda: 0)
|
languages_count: dict[str, int] = dict.fromkeys(ressource.language.choices, 0)
|
||||||
|
|
||||||
for data in datas:
|
for data in datas:
|
||||||
language = extract.language.extract(data)
|
language = extract.language.extract(data)
|
||||||
|
@ -34,6 +32,10 @@ def analyse(datas: list[dict]) -> plt.Figure:
|
||||||
axes.set_title("Nombre moyen de mission complété par langue")
|
axes.set_title("Nombre moyen de mission complété par langue")
|
||||||
|
|
||||||
# bar chart
|
# bar chart
|
||||||
axes.bar(x, y, edgecolor='black')
|
axes.bar(x, y, color=ressource.language.colors, edgecolor='black')
|
||||||
|
axes.set_xticks(x)
|
||||||
|
axes.set_xticklabels(ressource.language.labels)
|
||||||
|
axes.set_xlabel("Langue")
|
||||||
|
axes.set_ylabel("Complétion")
|
||||||
|
|
||||||
return figure
|
return figure
|
||||||
|
|
|
@ -23,11 +23,14 @@ def analyse(datas: list[dict]) -> plt.Figure:
|
||||||
# prepare plotting
|
# prepare plotting
|
||||||
figure: plt.Figure = plt.figure()
|
figure: plt.Figure = plt.figure()
|
||||||
axes = figure.add_subplot(1, 1, 1)
|
axes = figure.add_subplot(1, 1, 1)
|
||||||
axes.set_title("Nombre de personne ayant réussi par mission")
|
axes.set_title("Nombre de mission total complété")
|
||||||
|
|
||||||
# bar chart
|
# bar chart
|
||||||
axes.bar(x, y, edgecolor='black')
|
axes.bar(x, y, color=ressource.mission.colors, edgecolor='black')
|
||||||
|
axes.set_xlabel("Mission")
|
||||||
|
axes.set_ylabel("Complétion")
|
||||||
axes.set_xticks(x)
|
axes.set_xticks(x)
|
||||||
axes.set_xticklabels(x, rotation=45)
|
axes.set_xticklabels(ressource.mission.labels, rotation=45, ha="right")
|
||||||
|
figure.tight_layout()
|
||||||
|
|
||||||
return figure
|
return figure
|
||||||
|
|
|
@ -33,9 +33,13 @@ def analyse(datas: list[dict]) -> plt.Figure:
|
||||||
# prepare plotting
|
# prepare plotting
|
||||||
figure: plt.Figure = plt.figure()
|
figure: plt.Figure = plt.figure()
|
||||||
axes = figure.add_subplot(1, 1, 1)
|
axes = figure.add_subplot(1, 1, 1)
|
||||||
axes.set_title("Nombre moyen de mission complété par niveau")
|
axes.set_title("Nombre moyen de mission complété par habitude d'utilisation")
|
||||||
|
|
||||||
# bar chart
|
# bar chart
|
||||||
axes.bar(x, y, edgecolor='black')
|
axes.bar(x, y, color=ressource.usage.colors, edgecolor='black')
|
||||||
|
axes.set_xticks(x)
|
||||||
|
axes.set_xticklabels(ressource.usage.labels)
|
||||||
|
axes.set_xlabel("Usage")
|
||||||
|
axes.set_ylabel("Complétion")
|
||||||
|
|
||||||
return figure
|
return figure
|
||||||
|
|
|
@ -37,5 +37,7 @@ def analyse(datas: list[dict]) -> plt.Figure:
|
||||||
# bar chart
|
# bar chart
|
||||||
bins = np.arange(min(x), max(x), 1)
|
bins = np.arange(min(x), max(x), 1)
|
||||||
axes.hist(x, bins, weights=y, edgecolor="black")
|
axes.hist(x, bins, weights=y, edgecolor="black")
|
||||||
|
axes.set_xlabel("Âge")
|
||||||
|
axes.set_ylabel("Durée")
|
||||||
|
|
||||||
return figure
|
return figure
|
||||||
|
|
|
@ -29,9 +29,13 @@ def analyse(datas: list[dict]) -> plt.Figure:
|
||||||
# prepare plotting
|
# prepare plotting
|
||||||
figure: plt.Figure = plt.figure()
|
figure: plt.Figure = plt.figure()
|
||||||
axes = figure.add_subplot(1, 1, 1)
|
axes = figure.add_subplot(1, 1, 1)
|
||||||
axes.set_title("Temps moyen passé par expérience")
|
axes.set_title("Temps moyen passé par opinion")
|
||||||
|
|
||||||
# bar chart
|
# bar chart
|
||||||
axes.bar(x, y, edgecolor='black')
|
axes.bar(x, y, color=ressource.experience.colors, edgecolor='black')
|
||||||
|
axes.set_xticks(x)
|
||||||
|
axes.set_xticklabels(ressource.experience.labels)
|
||||||
|
axes.set_xlabel("Expérience")
|
||||||
|
axes.set_ylabel("Durée")
|
||||||
|
|
||||||
return figure
|
return figure
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
from collections import defaultdict
|
|
||||||
|
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from tools.statistics import extract
|
from tools.statistics import extract, ressource
|
||||||
|
|
||||||
|
|
||||||
def analyse(datas: list[dict]) -> plt.Figure:
|
def analyse(datas: list[dict]) -> plt.Figure:
|
||||||
languages_duration: dict[str, int] = defaultdict(lambda: 0)
|
languages_duration: dict[str, int] = dict.fromkeys(ressource.language.choices, 0)
|
||||||
languages_count: dict[str, int] = defaultdict(lambda: 0)
|
languages_count: dict[str, int] = dict.fromkeys(ressource.language.choices, 0)
|
||||||
|
|
||||||
for data in datas:
|
for data in datas:
|
||||||
language = extract.language.extract(data)
|
language = extract.language.extract(data)
|
||||||
|
@ -33,6 +31,10 @@ def analyse(datas: list[dict]) -> plt.Figure:
|
||||||
axes.set_title("Temps moyen passé par langue")
|
axes.set_title("Temps moyen passé par langue")
|
||||||
|
|
||||||
# bar chart
|
# bar chart
|
||||||
axes.bar(x, y, edgecolor='black')
|
axes.bar(x, y, color=ressource.language.colors, edgecolor='black')
|
||||||
|
axes.set_xticks(x)
|
||||||
|
axes.set_xticklabels(ressource.language.labels)
|
||||||
|
axes.set_xlabel("Langue")
|
||||||
|
axes.set_ylabel("Durée")
|
||||||
|
|
||||||
return figure
|
return figure
|
||||||
|
|
|
@ -24,11 +24,14 @@ def analyse(datas: list[dict]) -> plt.Figure:
|
||||||
# prepare plotting
|
# prepare plotting
|
||||||
figure: plt.Figure = plt.figure()
|
figure: plt.Figure = plt.figure()
|
||||||
axes = figure.add_subplot(1, 1, 1)
|
axes = figure.add_subplot(1, 1, 1)
|
||||||
axes.set_title("Temps moyen passé par test")
|
axes.set_title("Temps total passé par mission")
|
||||||
|
|
||||||
# bar chart
|
# bar chart
|
||||||
axes.bar(x, y, edgecolor='black')
|
axes.bar(x, y, color=ressource.mission.colors, edgecolor='black')
|
||||||
|
axes.set_xlabel("Mission")
|
||||||
|
axes.set_ylabel("Durée")
|
||||||
axes.set_xticks(x)
|
axes.set_xticks(x)
|
||||||
axes.set_xticklabels(x, rotation=45)
|
axes.set_xticklabels(ressource.mission.labels, rotation=45, ha="right")
|
||||||
|
figure.tight_layout()
|
||||||
|
|
||||||
return figure
|
return figure
|
||||||
|
|
|
@ -28,9 +28,13 @@ def analyse(datas: list[dict]) -> plt.Figure:
|
||||||
# prepare plotting
|
# prepare plotting
|
||||||
figure: plt.Figure = plt.figure()
|
figure: plt.Figure = plt.figure()
|
||||||
axes = figure.add_subplot(1, 1, 1)
|
axes = figure.add_subplot(1, 1, 1)
|
||||||
axes.set_title("Temps moyen passé par niveau")
|
axes.set_title("Temps moyen passé par habitude d'utilisation")
|
||||||
|
|
||||||
# bar chart
|
# bar chart
|
||||||
axes.bar(x, y, edgecolor='black')
|
axes.bar(x, y, color=ressource.usage.colors, edgecolor='black')
|
||||||
|
axes.set_xticks(x)
|
||||||
|
axes.set_xticklabels(ressource.usage.labels)
|
||||||
|
axes.set_xlabel("Usage")
|
||||||
|
axes.set_ylabel("Durée")
|
||||||
|
|
||||||
return figure
|
return figure
|
||||||
|
|
|
@ -18,9 +18,13 @@ def analyse(datas: list[dict]) -> plt.Figure:
|
||||||
# prepare plotting
|
# prepare plotting
|
||||||
figure: plt.Figure = plt.figure()
|
figure: plt.Figure = plt.figure()
|
||||||
axes = figure.add_subplot(1, 1, 1)
|
axes = figure.add_subplot(1, 1, 1)
|
||||||
axes.set_title("Nombre de personne par expérience")
|
axes.set_title("Opinion des personnes sondées")
|
||||||
|
|
||||||
# bar chart
|
# bar chart
|
||||||
axes.bar(x, y, edgecolor='black')
|
axes.bar(x, y, color=ressource.experience.colors, edgecolor='black')
|
||||||
|
axes.set_xticks(x)
|
||||||
|
axes.set_xticklabels(ressource.experience.labels)
|
||||||
|
axes.set_xlabel("Expérience")
|
||||||
|
axes.set_ylabel("Quantité")
|
||||||
|
|
||||||
return figure
|
return figure
|
||||||
|
|
|
@ -18,8 +18,11 @@ def analyse(datas: list[dict]) -> plt.Figure:
|
||||||
axes.set_title("Mission la plus difficile des personnes sondées")
|
axes.set_title("Mission la plus difficile des personnes sondées")
|
||||||
|
|
||||||
# bar chart
|
# bar chart
|
||||||
axes.bar(x, y, edgecolor='black')
|
axes.bar(x, y, color=ressource.mission.colors, edgecolor='black')
|
||||||
|
axes.set_xlabel("Mission")
|
||||||
|
axes.set_ylabel("Quantité")
|
||||||
axes.set_xticks(x)
|
axes.set_xticks(x)
|
||||||
axes.set_xticklabels(x, rotation=45)
|
axes.set_xticklabels(ressource.mission.labels, rotation=45, ha="right")
|
||||||
|
figure.tight_layout()
|
||||||
|
|
||||||
return figure
|
return figure
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
from collections import Counter
|
|
||||||
|
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
from tools.statistics import extract
|
from tools.statistics import extract, ressource
|
||||||
|
|
||||||
|
|
||||||
def analyse(datas: list[dict]) -> plt.Figure:
|
def analyse(datas: list[dict]) -> plt.Figure:
|
||||||
languages = list(map(extract.language.extract, datas))
|
languages = dict.fromkeys(ressource.language.choices, 0)
|
||||||
|
for language in map(extract.language.extract, datas):
|
||||||
|
languages[language] += 1
|
||||||
|
|
||||||
counter = Counter(languages)
|
x = list(languages.keys())
|
||||||
x = list(counter.keys())
|
y = list(languages.values())
|
||||||
y = list(counter.values())
|
|
||||||
|
|
||||||
# prepare plotting
|
# prepare plotting
|
||||||
figure: plt.Figure = plt.figure()
|
figure: plt.Figure = plt.figure()
|
||||||
|
@ -18,6 +17,10 @@ def analyse(datas: list[dict]) -> plt.Figure:
|
||||||
axes.set_title("Langue des personnes sondées")
|
axes.set_title("Langue des personnes sondées")
|
||||||
|
|
||||||
# bar chart
|
# bar chart
|
||||||
axes.bar(x, y, edgecolor='black')
|
axes.bar(x, y, color=ressource.language.colors, edgecolor='black')
|
||||||
|
axes.set_xticks(x)
|
||||||
|
axes.set_xticklabels(ressource.language.labels)
|
||||||
|
axes.set_xlabel("Langue")
|
||||||
|
axes.set_ylabel("Quantité")
|
||||||
|
|
||||||
return figure
|
return figure
|
||||||
|
|
|
@ -4,10 +4,8 @@ from tools.statistics import extract, ressource
|
||||||
|
|
||||||
|
|
||||||
def analyse(datas: list[dict]) -> plt.Figure:
|
def analyse(datas: list[dict]) -> plt.Figure:
|
||||||
usage_data = list(map(extract.usage.extract, datas))
|
|
||||||
|
|
||||||
usages: dict[str, int] = dict.fromkeys(ressource.usage.choices, 0)
|
usages: dict[str, int] = dict.fromkeys(ressource.usage.choices, 0)
|
||||||
for usage in usage_data:
|
for usage in map(extract.usage.extract, datas):
|
||||||
usages[usage] += 1
|
usages[usage] += 1
|
||||||
|
|
||||||
x = list(usages.keys())
|
x = list(usages.keys())
|
||||||
|
@ -16,9 +14,11 @@ def analyse(datas: list[dict]) -> plt.Figure:
|
||||||
# prepare plotting
|
# prepare plotting
|
||||||
figure: plt.Figure = plt.figure()
|
figure: plt.Figure = plt.figure()
|
||||||
axes = figure.add_subplot(1, 1, 1)
|
axes = figure.add_subplot(1, 1, 1)
|
||||||
axes.set_title("Expérience antérieure des personnes sondées")
|
axes.set_title("Habitude d'utilisation des personnes sondées")
|
||||||
|
|
||||||
# bar chart
|
# bar chart
|
||||||
axes.bar(x, y, edgecolor='black')
|
axes.bar(x, y, color=ressource.usage.colors, edgecolor='black')
|
||||||
|
axes.set_xticks(x)
|
||||||
|
axes.set_xticklabels(ressource.usage.labels)
|
||||||
|
|
||||||
return figure
|
return figure
|
||||||
|
|
|
@ -1,22 +1,28 @@
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
from matplotlib import pyplot as plt
|
||||||
|
|
||||||
from tools.statistics.analyse import (age, usage, completion_per_mission, duration_per_mission, completion_per_age,
|
from tools.statistics.analyse import (age, usage, completion_per_mission, duration_per_mission, completion_per_age,
|
||||||
completion_per_usage, duration_per_age, duration_per_usage,
|
completion_per_usage, duration_per_age, duration_per_usage,
|
||||||
completion_per_experience, duration_per_experience, experience, hardest_mission,
|
completion_per_experience, duration_per_experience, experience, hardest_mission,
|
||||||
language, duration_per_language, completion_per_language)
|
language, duration_per_language, completion_per_language)
|
||||||
|
|
||||||
|
|
||||||
|
plt.rcParams['text.usetex'] = True
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
from source.utils import compress
|
from source.utils import compress
|
||||||
|
|
||||||
# import matplotlib
|
import matplotlib
|
||||||
# matplotlib.use("pgf")
|
matplotlib.use("pgf")
|
||||||
# matplotlib.rcParams.update({
|
matplotlib.rcParams.update({
|
||||||
# "pgf.texsystem": "pdflatex",
|
"pgf.texsystem": "pdflatex",
|
||||||
# 'font.family': 'serif',
|
'font.family': 'serif',
|
||||||
# 'font.size': 11,
|
'font.size': 11,
|
||||||
# 'text.usetex': True,
|
'text.usetex': True,
|
||||||
# 'pgf.rcfonts': False,
|
'pgf.rcfonts': False,
|
||||||
# })
|
})
|
||||||
|
|
||||||
sondage_path = Path(r"./sondage/")
|
sondage_path = Path(r"./sondage/")
|
||||||
graph_path = Path(r"./graph/")
|
graph_path = Path(r"./graph/")
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
from . import experience
|
from . import experience
|
||||||
from . import mission
|
from . import mission
|
||||||
from . import usage
|
from . import usage
|
||||||
|
from . import language
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
choices = ["yes", "mixed", "no"]
|
choices = ["yes", "mixed", "no"]
|
||||||
|
labels = ["Oui", "Mitigé", "Non"]
|
||||||
|
colors = ["g", "y", "r"]
|
||||||
|
|
3
tools/statistics/ressource/language.py
Normal file
3
tools/statistics/ressource/language.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
choices = ["fr", "en", "es"]
|
||||||
|
labels = ["Français", "Anglais", "Espagnol"]
|
||||||
|
colors = ["b", "g", "r"]
|
|
@ -10,3 +10,27 @@ choices = [
|
||||||
"mission-gift-card",
|
"mission-gift-card",
|
||||||
"mission-workshop",
|
"mission-workshop",
|
||||||
]
|
]
|
||||||
|
labels = [
|
||||||
|
"Changement de Langue",
|
||||||
|
"Filtre de Prix",
|
||||||
|
"Hub de la Communauté",
|
||||||
|
"Page de Jeu",
|
||||||
|
"Page de DLC",
|
||||||
|
"Page d'Actualité",
|
||||||
|
"Page de Profil",
|
||||||
|
"Page de Discussion",
|
||||||
|
"Carte Cadeaux",
|
||||||
|
"Workshop",
|
||||||
|
]
|
||||||
|
colors = [
|
||||||
|
"tab:blue",
|
||||||
|
"tab:orange",
|
||||||
|
"tab:green",
|
||||||
|
"tab:red",
|
||||||
|
"tab:olive",
|
||||||
|
"tab:purple",
|
||||||
|
"tab:brown",
|
||||||
|
"tab:pink",
|
||||||
|
"tab:cyan",
|
||||||
|
"tab:gray",
|
||||||
|
]
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
choices = ["always", "often", "sometime", "rarely", "never"]
|
choices = ["always", "often", "sometime", "rarely", "never"]
|
||||||
|
labels = ["Toujours", "Souvent", "Parfois", "Rarement", "Jamais"]
|
||||||
|
colors = ["g", "c", "y", "m", "r"]
|
||||||
|
|
Loading…
Reference in a new issue