sciapy.plot_setup   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Test Coverage

Coverage 94.29%

Importance

Changes 0
Metric Value
eloc 39
dl 0
loc 62
ccs 33
cts 35
cp 0.9429
rs 10
c 0
b 0
f 0
wmc 2

1 Function

Rating   Name   Duplication   Size   Complexity  
A plot_setup() 0 33 2
1
# -*- coding: utf-8 -*-
2
# vim:fileencoding=utf-8
3
#
4
# Copyright (c) 2018 Stefan Bender
5
#
6
# This module is part of sciapy.
7
# sciapy is free software: you can redistribute it or modify
8
# it under the terms of the GNU General Public License as published
9
# by the Free Software Foundation, version 2.
10
# See accompanying LICENSE file or http://www.gnu.org/licenses/gpl-2.0.html.
11 1
"""Matplotlib figure set up
12
"""
13
14 1
from matplotlib import rcParams
15
16 1
__all__ = ["plot_setup", "GRID_STYLE", "LINE_SPINES", "LINE_TICKS"]
17
18 1
GRID_STYLE = {"axes.grid": True,
19
		"axes.grid.axis": "y",
20
		"grid.alpha": 0.5}
21
22 1
LINE_SPINES = {"axes.spines.left": True,
23
		"axes.spines.bottom": True}
24
25 1
LINE_TICKS = {"xtick.top": False,
26
		"ytick.right": False}
27
28
29 1
def plot_setup():
30 1
	rcParams["figure.dpi"] = 96
31 1
	rcParams["figure.figsize"] = [8, 5]
32 1
	rcParams["font.size"] = 16
33 1
	rcParams["mathtext.default"] = "regular"
34 1
	rcParams["savefig.dpi"] = 600
35 1
	rcParams["pdf.compression"] = 0
36 1
	rcParams["axes.linewidth"] = 1.5
37 1
	rcParams["lines.linewidth"] = 1.5
38
	# visible ticks
39 1
	rcParams["xtick.minor.visible"] = True
40 1
	rcParams["ytick.minor.visible"] = True
41 1
	rcParams["xtick.top"] = True
42 1
	rcParams["ytick.right"] = True
43
	# tick sizes and padding
44 1
	rcParams["xtick.major.width"] = 1.5
45 1
	rcParams["xtick.major.size"] = 6
46 1
	rcParams["xtick.major.pad"] = 8
47 1
	rcParams["ytick.major.width"] = 1.5
48 1
	rcParams["ytick.major.size"] = 6
49 1
	rcParams["ytick.major.pad"] = 8
50 1
	rcParams["xtick.minor.size"] = 3
51 1
	rcParams["ytick.minor.size"] = 3
52
	# turn off axis spines
53 1
	rcParams["axes.spines.left"] = False
54 1
	rcParams["axes.spines.bottom"] = False
55 1
	rcParams["axes.spines.top"] = False
56 1
	rcParams["axes.spines.right"] = False
57
	# use constrained layout if available (matplotlib >= 2.2)
58 1
	try:
59 1
		rcParams["figure.constrained_layout.use"] = True
60
	except KeyError:
61
		pass
62