Commit 709f622c authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

change the signature of the function savefig.

parent b5d1f658
......@@ -22,7 +22,7 @@ def dashboard():
"""
cfg = Storage()
cfg.Graph_selectorCumulative = True
cfg.Graph_selectorCumulative = 'True'
cfg.Graph_selectorId = ''
cfg.Graph_selectorId_authors_roles = ''
cfg.Graph_selectorId_graphs = ''
......@@ -36,9 +36,6 @@ def dashboard():
fields = ('cumulative','id_graphs', 'year_start','year_end')
selector = Selector(virtdb.graph_selector, exclude_fields=fields)
# BUG in plugin_dbui.slector 0.7.1
selector.cumulative = True
# the cumulative sum of publications for the current year
ax = do_linechart(db.publications, selector)
......@@ -53,7 +50,7 @@ def dashboard():
# delegate the rendering to the view
response.view = "graphs/index.html"
return dict(data=savefig(ax, "svg"))
return dict(data=savefig(ax.get_figure(), "svg"))
def index():
......@@ -77,4 +74,4 @@ def index():
# delegate the rendering to the view
fmt = "svg" if selector.format == "html" else selector.format
return dict(data=savefig(ax, fmt))
return dict(data=savefig(ax.get_figure(), fmt))
......@@ -317,19 +317,17 @@ def do_title(ax, db, selector):
ax.set_title(title.decode("utf-8"))
def savefig(ax, fmt):
def savefig(fig, fmt):
"""Save the figure as a string.
Args:
ax (matplotlib.AxesSubplot): axes subplot
fig (matplotlib.figure): the figure.
fmt (str): possible values are pdf, png and svg.
Return:
str:
"""
fig = ax.get_figure()
fi = StringIO()
fig.savefig(fi, format=fmt)
data = fi.getvalue()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment