Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Docker-in-Docker (DinD) capabilities of public runners deactivated.
More info
Open sidebar
limbra
limbra
Commits
52483d05
Commit
52483d05
authored
Nov 06, 2019
by
LE GAC Renaud
Browse files
Update controller graph and graph_tools to define plot style (matplotlib 2.2.3)
parent
ad8fd5d9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
4 deletions
+28
-4
controllers/graphs.py
controllers/graphs.py
+4
-0
modules/graph_tools.py
modules/graph_tools.py
+24
-4
No files found.
controllers/graphs.py
View file @
52483d05
...
...
@@ -12,11 +12,15 @@ from gluon.storage import Storage
from
graph_tools
import
(
FROM_TO
,
LABELY_YEAR
,
linechart
,
mplstyle
,
savefig
,
stackchart
)
from
model_selector
import
YEAR_SUBMIT
mplstyle
()
def
dashboard
():
"""Return a pre-configure linechart for public used.
Cumulative distribution for the publications are shown for
...
...
modules/graph_tools.py
View file @
52483d05
...
...
@@ -145,6 +145,30 @@ def emptychart(db, selector, target=None):
return
ax
def
mplstyle
():
"""Helper function to define matplotlib style for plots.
"""
mpl
.
rcParams
[
"font.size"
]
=
8
mpl
.
rcParams
[
"grid.alpha"
]
=
0.5
mpl
.
rcParams
[
"grid.linestyle"
]
=
"dotted"
mpl
.
rcParams
[
"xtick.direction"
]
=
"in"
mpl
.
rcParams
[
"xtick.top"
]
=
True
mpl
.
rcParams
[
"xtick.bottom"
]
=
True
mpl
.
rcParams
[
"xtick.major.size"
]
=
8
mpl
.
rcParams
[
"xtick.minor.size"
]
=
4
mpl
.
rcParams
[
"xtick.labelsize"
]
=
8
mpl
.
rcParams
[
"ytick.direction"
]
=
"in"
mpl
.
rcParams
[
"ytick.left"
]
=
True
mpl
.
rcParams
[
"ytick.right"
]
=
True
mpl
.
rcParams
[
"ytick.major.size"
]
=
8
mpl
.
rcParams
[
"ytick.minor.size"
]
=
4
mpl
.
rcParams
[
"ytick.labelsize"
]
=
8
def
linechart
(
db
,
selector
,
target
=
None
,
title
=
None
,
xlabel
=
None
,
ylabel
=
None
):
"""Build a line chart showing the number of publications as a function
of the time.
...
...
@@ -211,8 +235,6 @@ def linechart(db, selector, target=None, title=None, xlabel=None, ylabel=None):
#
# instantiate the graph
#
mpl
.
rcParams
[
'legend.fontsize'
]
=
10
if
is_submit_month
:
df
.
index
=
DatetimeIndex
(
df
.
index
)
...
...
@@ -495,8 +517,6 @@ def stackchart(db, selector, target=None):
#
# instantiate the graph
#
mpl
.
rcParams
[
'legend.fontsize'
]
=
10
kwargs
=
{}
if
is_submit_month
:
df
.
index
=
DatetimeIndex
(
df
.
index
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment