basic ploting for skills

This commit is contained in:
Benjamin Bertrand 2017-03-07 18:52:37 +03:00
parent 0fba0017fe
commit b543e15f59
4 changed files with 30 additions and 3 deletions

View File

@ -19,7 +19,7 @@ def includegraphics(fig_ax, document_path="./", fig_path="fig/",
""" """
try: try:
fig, ax = fig_ax fig, ax = fig_ax
except TypeError: except (TypeError, ValueError):
ax = fig_ax ax = fig_ax
fig = ax.figure fig = ax.figure

View File

@ -18,6 +18,11 @@
\Var{e["quest"] | radar_on("Competence") | includegraphics(document_path=directory, scale=0.6)} \Var{e["quest"] | radar_on("Competence") | includegraphics(document_path=directory, scale=0.6)}
\Var{e["quest"] | radar_on("Domaine") | includegraphics(document_path=directory, scale=0.6)} \Var{e["quest"] | radar_on("Domaine") | includegraphics(document_path=directory, scale=0.6)}
\vfill
\hspace{-2cm}
\Var{e["quest"] | pies_skills_level("Competence") | includegraphics(document_path=directory, scale=0.3)}
\vfill \vfill
%#\Var{conn_df} %#\Var{conn_df}
%- if not conn_df.empty %- if not conn_df.empty

View File

@ -31,10 +31,12 @@ texenv = jinja2.Environment(
from .filters import includegraphics from .filters import includegraphics
texenv.filters['includegraphics'] = includegraphics texenv.filters['includegraphics'] = includegraphics
from notes_tools.tools.marks_plottings import radar_on, marks_hist, parallele_on from notes_tools.tools.marks_plottings import *
texenv.filters['radar_on'] = radar_on texenv.filters['radar_on'] = radar_on
texenv.filters['marks_hist'] = marks_hist texenv.filters['marks_hist'] = marks_hist
texenv.filters['parallele_on'] = parallele_on texenv.filters['parallele_on'] = parallele_on
texenv.filters['pie_skill_evaluation'] = pie_skill_evaluation
texenv.filters['pies_skills_level'] = pies_skills_level
def feed_template(target, datas, template): def feed_template(target, datas, template):
""" Get the template and feed it to create reports """ Get the template and feed it to create reports

View File

@ -2,10 +2,17 @@
# encoding: utf-8 # encoding: utf-8
from .plottings import radar_graph from .plottings import radar_graph
from .skills_tools import count_levels, count_skill_evaluation
import matplotlib.pyplot as plt
import pandas as pd import pandas as pd
import numpy as np import numpy as np
__all__ = ["radar_on", "marks_hist", "parallele_on"] __all__ = ["radar_on",
"pie_skill_evaluation",
"pies_skills_level",
"marks_hist",
"parallele_on",
]
def radar_on(df, index, optimum = None): def radar_on(df, index, optimum = None):
""" Plot the radar graph concerning index column of the df """ Plot the radar graph concerning index column of the df
@ -26,6 +33,19 @@ def radar_on(df, index, optimum = None):
fig, ax = radar_graph(labels, values, optimum) fig, ax = radar_graph(labels, values, optimum)
return fig, ax return fig, ax
def pie_skill_evaluation(df, skill):
""" Plot a pie plot with the repartition of skill evaluations
"""
ax = count_skill_evaluation(df, skill).plot.pie(autopct='%.0f')
return ax
def pies_skills_level(df, skill):
""" Plot series of pies (one by different skill) with level repartition """
levels_counts = count_levels(df, skill)
fig, ax = plt.subplots(nrows=1, ncols=len(levels_counts), figsize=(16,3))
plots = levels_counts.T.plot(ax=ax ,kind="pie", subplots=True, legend=False)
return fig, ax
def marks_hist(df): def marks_hist(df):
""" Return axe for the histogramme of the dataframe """ Return axe for the histogramme of the dataframe