Remove try:... for plots to free memory

This commit is contained in:
Benjamin Bertrand
2017-04-01 15:32:19 +03:00
parent db4d6c2b79
commit 2acdcc64b0
4 changed files with 78 additions and 109 deletions

View File

@@ -4,6 +4,7 @@
from uuid import uuid4
from path import Path
import logging
import matplotlib.pyplot as plt
logger = logging.getLogger(__name__)
def includegraphics(fig_ax, document_path="./", fig_path="fig/",
@@ -34,6 +35,7 @@ def includegraphics(fig_ax, document_path="./", fig_path="fig/",
fig.tight_layout()
fig.savefig(path_to_file/filename)
logger.info("Graphique {} sauvé à {}".format(filename, path_to_file))
plt.close(fig)
return "\includegraphics[scale={sc}]{{{f}}}".format(sc = scale,
f=Path(fig_path)/filename)

View File

@@ -50,9 +50,12 @@ Compétences
\vfill
\Var{e.pies_on_competence | includegraphics(document_path=directory, scale=0.3)}
\Var{e.pies_on_domaine | includegraphics(document_path=directory, scale=0.3)}
\Var{e.heatmap_on_competence | includegraphics(document_path=directory, scale=0.6)}
\Var{e.heatmap_on_domain | includegraphics(document_path=directory, scale=0.6)}
%# \Var{e.pies_on_competence | includegraphics(document_path=directory, scale=0.3)}
%# \Var{e.pies_on_domaine | includegraphics(document_path=directory, scale=0.3)}
%#\Var{conn_df}