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
|
|
|
"""SCIAMACHY plot setup tests |
12
|
|
|
""" |
13
|
|
|
|
14
|
|
|
import sciapy |
15
|
|
|
from sciapy import plot_setup |
16
|
|
|
|
17
|
|
|
|
18
|
|
|
def test_module_structure(): |
19
|
|
|
assert sciapy.plot_setup.plot_setup |
20
|
|
|
assert plot_setup.plot_setup |
21
|
|
|
|
22
|
|
|
|
23
|
|
|
def test_plot_setup(): |
24
|
|
|
from matplotlib import rcParams |
25
|
|
|
plot_setup.plot_setup() |
26
|
|
|
assert rcParams["figure.dpi"] == 96 |
27
|
|
|
assert rcParams["figure.figsize"] == [8, 5] |
28
|
|
|
assert rcParams["figure.constrained_layout.use"] |
29
|
|
|
assert rcParams["font.size"] == 16 |
30
|
|
|
assert rcParams['mathtext.default'] == 'regular' |
31
|
|
|
assert rcParams['savefig.dpi'] == 600 |
32
|
|
|
assert rcParams['pdf.compression'] == 0 |
33
|
|
|
assert rcParams['axes.linewidth'] == 1.5 |
34
|
|
|
assert rcParams['lines.linewidth'] == 1.5 |
35
|
|
|
# visible ticks |
36
|
|
|
assert rcParams["xtick.minor.visible"] |
37
|
|
|
assert rcParams["ytick.minor.visible"] |
38
|
|
|
assert rcParams["xtick.top"] |
39
|
|
|
assert rcParams["ytick.right"] |
40
|
|
|
# tick sizes and padding |
41
|
|
|
assert rcParams["xtick.major.width"] == 1.5 |
42
|
|
|
assert rcParams["xtick.major.size"] == 6 |
43
|
|
|
assert rcParams["xtick.major.pad"] == 8 |
44
|
|
|
assert rcParams["ytick.major.width"] == 1.5 |
45
|
|
|
assert rcParams["ytick.major.size"] == 6 |
46
|
|
|
assert rcParams["ytick.major.pad"] == 8 |
47
|
|
|
assert rcParams["xtick.minor.size"] == 3 |
48
|
|
|
assert rcParams["ytick.minor.size"] == 3 |
49
|
|
|
# turn off axis spines |
50
|
|
|
assert not rcParams["axes.spines.left"] |
51
|
|
|
assert not rcParams["axes.spines.bottom"] |
52
|
|
|
assert not rcParams["axes.spines.top"] |
53
|
|
|
assert not rcParams["axes.spines.right"] |
54
|
|
|
|
55
|
|
|
|
56
|
|
|
def test_grid_lines(): |
57
|
|
|
from matplotlib import rcParams |
58
|
|
|
rcParams.update(plot_setup.GRID_STYLE) |
59
|
|
|
assert rcParams["axes.grid"] |
60
|
|
|
assert rcParams["axes.grid.axis"] == "y" |
61
|
|
|
assert rcParams["grid.alpha"] == 0.5 |
62
|
|
|
|
63
|
|
|
|
64
|
|
|
def test_line_spines(): |
65
|
|
|
from matplotlib import rcParams |
66
|
|
|
rcParams.update(plot_setup.LINE_SPINES) |
67
|
|
|
assert rcParams["axes.spines.left"] |
68
|
|
|
assert rcParams["axes.spines.bottom"] |
69
|
|
|
|
70
|
|
|
|
71
|
|
|
def test_line_ticks(): |
72
|
|
|
from matplotlib import rcParams |
73
|
|
|
rcParams.update(plot_setup.LINE_TICKS) |
74
|
|
|
assert not rcParams["xtick.top"] |
75
|
|
|
assert not rcParams["ytick.right"] |
76
|
|
|
|