aptapy 0.1.1__py3-none-any.whl → 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aptapy/_version.py +1 -1
- aptapy/hist.py +226 -0
- aptapy/modeling.py +22 -22
- aptapy/plotting.py +325 -288
- {aptapy-0.1.1.dist-info → aptapy-0.2.0.dist-info}/METADATA +1 -1
- aptapy-0.2.0.dist-info/RECORD +11 -0
- aptapy-0.1.1.dist-info/RECORD +0 -10
- {aptapy-0.1.1.dist-info → aptapy-0.2.0.dist-info}/WHEEL +0 -0
- {aptapy-0.1.1.dist-info → aptapy-0.2.0.dist-info}/licenses/LICENSE +0 -0
aptapy/_version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "0.
|
1
|
+
__version__ = "0.2.0"
|
aptapy/hist.py
ADDED
@@ -0,0 +1,226 @@
|
|
1
|
+
# Copyright (C) 2025 Luca Baldini (luca.baldini@pi.infn.it)
|
2
|
+
#
|
3
|
+
# This program is free software: you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU General Public License as published by
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
15
|
+
|
16
|
+
"""Histogram facilities.
|
17
|
+
"""
|
18
|
+
|
19
|
+
from abc import ABC, abstractmethod
|
20
|
+
from typing import List, Sequence
|
21
|
+
|
22
|
+
import numpy as np
|
23
|
+
|
24
|
+
from .plotting import matplotlib, plt, setup_axes
|
25
|
+
from .typing_ import ArrayLike
|
26
|
+
|
27
|
+
|
28
|
+
class AbstractHistogram(ABC):
|
29
|
+
|
30
|
+
"""Abstract base class for an n-dimensional histogram.
|
31
|
+
|
32
|
+
Arguments
|
33
|
+
---------
|
34
|
+
edges : n-dimensional sequence of arrays
|
35
|
+
the bin edges on the different axes.
|
36
|
+
|
37
|
+
labels : sequence of strings
|
38
|
+
the text labels for the different axes.
|
39
|
+
"""
|
40
|
+
|
41
|
+
DEFAULT_PLOT_OPTIONS = {}
|
42
|
+
|
43
|
+
def __init__(self, edges: Sequence[np.ndarray], labels: List[str]) -> None:
|
44
|
+
"""Constructor.
|
45
|
+
"""
|
46
|
+
# Edges are fixed once and forever, so we create a copy. Also, no matter
|
47
|
+
# which kind of sequence we are passing, we turn the thing into a tuple.
|
48
|
+
self._edges = tuple(np.asarray(item, dtype=float).copy() for item in edges)
|
49
|
+
self._num_axes = len(self._edges)
|
50
|
+
|
51
|
+
# And a few basic checks on the input arguments.
|
52
|
+
for item in self._edges:
|
53
|
+
if item.ndim != 1:
|
54
|
+
raise ValueError(f"Bin edges {item} are not a 1-dimensional array.")
|
55
|
+
if item.size < 2:
|
56
|
+
raise ValueError(f"Bin edges {item} have less than 2 entries.")
|
57
|
+
if np.any(np.diff(item) <= 0):
|
58
|
+
raise ValueError(f"Bin edges {item} not strictly increasing.")
|
59
|
+
if labels is not None and len(labels) > self._num_axes + 1:
|
60
|
+
raise ValueError(f"Too many labels {labels} for {self._num_axes} axes.")
|
61
|
+
|
62
|
+
# Go ahead and create all the necessary data structures.
|
63
|
+
self._shape = tuple(item.size - 1 for item in self._edges)
|
64
|
+
self._sumw = np.zeros(self._shape, dtype=float)
|
65
|
+
self._sumw2 = np.zeros(self._shape, dtype=float)
|
66
|
+
self._labels = labels
|
67
|
+
|
68
|
+
@property
|
69
|
+
def content(self) -> np.ndarray:
|
70
|
+
"""Return the bin contents.
|
71
|
+
"""
|
72
|
+
return self._sumw
|
73
|
+
|
74
|
+
@property
|
75
|
+
def errors(self) -> np.ndarray:
|
76
|
+
"""Return the bin errors.
|
77
|
+
"""
|
78
|
+
return np.sqrt(self._sumw2)
|
79
|
+
|
80
|
+
def bin_edges(self, axis: int = 0) -> np.ndarray:
|
81
|
+
"""Return a view on the binning for specific axis.
|
82
|
+
"""
|
83
|
+
return self._edges[axis].view()
|
84
|
+
|
85
|
+
def bin_centers(self, axis: int = 0) -> np.ndarray:
|
86
|
+
"""Return the bin centers for a specific axis.
|
87
|
+
"""
|
88
|
+
return 0.5 * (self._edges[axis][1:] + self._edges[axis][:-1])
|
89
|
+
|
90
|
+
def bin_widths(self, axis: int = 0) -> np.ndarray:
|
91
|
+
"""Return the bin widths for a specific axis.
|
92
|
+
"""
|
93
|
+
return np.diff(self._edges[axis])
|
94
|
+
|
95
|
+
def fill(self, *values: ArrayLike, weights: ArrayLike = None) -> "AbstractHistogram":
|
96
|
+
"""Fill the histogram from unbinned data.
|
97
|
+
|
98
|
+
Note this method is returning the histogram instance, so that the function
|
99
|
+
call can be chained.
|
100
|
+
"""
|
101
|
+
values = np.vstack(values).T
|
102
|
+
sumw, _ = np.histogramdd(values, bins=self._edges, weights=weights)
|
103
|
+
if weights is None:
|
104
|
+
sumw2 = sumw
|
105
|
+
else:
|
106
|
+
sumw2, _ = np.histogramdd(values, bins=self._edges, weights=weights**2.)
|
107
|
+
self._sumw += sumw
|
108
|
+
self._sumw2 += sumw2
|
109
|
+
return self
|
110
|
+
|
111
|
+
def copy(self) -> "AbstractHistogram":
|
112
|
+
"""Create a full copy of a histogram.
|
113
|
+
"""
|
114
|
+
# pylint: disable=protected-access
|
115
|
+
# Note we really need the * in the constructor, here, as the abstract
|
116
|
+
# base class is never instantiated, and the arguments are unpacked in the
|
117
|
+
# constructors of all the derived classes.
|
118
|
+
histogram = self.__class__(*self._edges, *self._labels)
|
119
|
+
histogram._sumw = self._sumw.copy()
|
120
|
+
histogram._sumw2 = self._sumw2.copy()
|
121
|
+
return histogram
|
122
|
+
|
123
|
+
def _check_compat(self, other: "AbstractHistogram") -> None:
|
124
|
+
"""Check whether two histogram objects are compatible with each other,
|
125
|
+
meaning, e.g., that they can be summed or subtracted.
|
126
|
+
"""
|
127
|
+
# pylint: disable=protected-access
|
128
|
+
if not isinstance(other, AbstractHistogram):
|
129
|
+
raise TypeError(f"{other} is not a histogram.")
|
130
|
+
if self._num_axes != other._num_axes or self._shape != other._shape:
|
131
|
+
raise ValueError("Histogram dimensionality/shape mismatch.")
|
132
|
+
for edges in zip(self._edges, other._edges):
|
133
|
+
if not np.allclose(*edges):
|
134
|
+
raise ValueError("Histogram bin edges differ.")
|
135
|
+
|
136
|
+
def __iadd__(self, other: "AbstractHistogram") -> "AbstractHistogram":
|
137
|
+
"""Histogram addition (in place).
|
138
|
+
"""
|
139
|
+
self._check_compat(other)
|
140
|
+
self._sumw += other._sumw
|
141
|
+
self._sumw2 += other._sumw2
|
142
|
+
return self
|
143
|
+
|
144
|
+
def __add__(self, other: "AbstractHistogram") -> "AbstractHistogram":
|
145
|
+
"""Histogram addition.
|
146
|
+
"""
|
147
|
+
histogram = self.copy()
|
148
|
+
histogram += other
|
149
|
+
return histogram
|
150
|
+
|
151
|
+
def __isub__(self, other: "AbstractHistogram") -> "AbstractHistogram":
|
152
|
+
"""Histogram subtraction (in place).
|
153
|
+
"""
|
154
|
+
self._check_compat(other)
|
155
|
+
self._sumw -= other._sumw
|
156
|
+
self._sumw2 += other._sumw2
|
157
|
+
return self
|
158
|
+
|
159
|
+
def __sub__(self, other: "AbstractHistogram") -> "AbstractHistogram":
|
160
|
+
"""Histogram subtraction.
|
161
|
+
"""
|
162
|
+
histogram = self.copy()
|
163
|
+
histogram -= other
|
164
|
+
return histogram
|
165
|
+
|
166
|
+
@abstractmethod
|
167
|
+
def _do_plot(self, axes, **kwargs) -> None:
|
168
|
+
pass
|
169
|
+
|
170
|
+
def plot(self, axes=None, **kwargs) -> None:
|
171
|
+
"""Plot the histogram.
|
172
|
+
"""
|
173
|
+
if axes is None:
|
174
|
+
axes = plt.gca()
|
175
|
+
for key, value in self.DEFAULT_PLOT_OPTIONS.items():
|
176
|
+
kwargs.setdefault(key, value)
|
177
|
+
self._do_plot(axes, **kwargs)
|
178
|
+
|
179
|
+
def __repr__(self) -> str:
|
180
|
+
"""String representation of the histogram.
|
181
|
+
"""
|
182
|
+
return f"{self.__class__.__name__}({self._num_axes} axes, shape={self._shape})"
|
183
|
+
|
184
|
+
|
185
|
+
class Histogram1d(AbstractHistogram):
|
186
|
+
|
187
|
+
"""One-dimensional histogram.
|
188
|
+
"""
|
189
|
+
|
190
|
+
DEFAULT_PLOT_OPTIONS = dict(linewidth=1.25, alpha=0.4, histtype="stepfilled")
|
191
|
+
|
192
|
+
def __init__(self, xedges: np.ndarray, xlabel: str = "", ylabel: str = "Entries/bin") -> None:
|
193
|
+
"""Constructor.
|
194
|
+
"""
|
195
|
+
super().__init__((xedges, ), [xlabel, ylabel])
|
196
|
+
|
197
|
+
def _do_plot(self, axes: matplotlib.axes._axes.Axes, **kwargs) -> None:
|
198
|
+
"""Overloaded make_plot() method.
|
199
|
+
"""
|
200
|
+
axes.hist(self.bin_centers(0), self._edges[0], weights=self.content, **kwargs)
|
201
|
+
setup_axes(axes, xlabel=self._labels[0], ylabel=self._labels[1])
|
202
|
+
|
203
|
+
|
204
|
+
class Histogram2d(AbstractHistogram):
|
205
|
+
|
206
|
+
"""Two-dimensional histogram.
|
207
|
+
"""
|
208
|
+
|
209
|
+
DEFAULT_PLOT_OPTIONS = dict(cmap=plt.get_cmap('hot'))
|
210
|
+
|
211
|
+
def __init__(self, xedges, yedges, xlabel='', ylabel='', zlabel='Entries/bin') -> None:
|
212
|
+
"""Constructor.
|
213
|
+
"""
|
214
|
+
super().__init__((xedges, yedges), [xlabel, ylabel, zlabel])
|
215
|
+
|
216
|
+
def _do_plot(self, axes: matplotlib.axes._axes.Axes, logz: bool = False, **kwargs) -> None:
|
217
|
+
"""Overloaded make_plot() method.
|
218
|
+
"""
|
219
|
+
# pylint: disable=arguments-differ
|
220
|
+
if logz:
|
221
|
+
vmin = kwargs.pop('vmin', None)
|
222
|
+
vmax = kwargs.pop('vmax', None)
|
223
|
+
kwargs.setdefault('norm', matplotlib.colors.LogNorm(vmin, vmax))
|
224
|
+
mappable = axes.pcolormesh(*self._edges, self.content.T, **kwargs)
|
225
|
+
plt.colorbar(mappable, ax=axes, label=self._labels[2])
|
226
|
+
setup_axes(axes, xlabel=self._labels[0], ylabel=self._labels[1])
|
aptapy/modeling.py
CHANGED
@@ -37,11 +37,11 @@ class Format(str, enum.Enum):
|
|
37
37
|
"""Small enum class to control string formatting.
|
38
38
|
|
39
39
|
This is leveraging the custom formatting of the uncertainties package, where
|
40
|
-
a trailing
|
40
|
+
a trailing `P` means "pretty print" and a trailing `L` means "LaTeX".
|
41
41
|
"""
|
42
42
|
|
43
|
-
PRETTY =
|
44
|
-
LATEX =
|
43
|
+
PRETTY = "P"
|
44
|
+
LATEX = "L"
|
45
45
|
|
46
46
|
|
47
47
|
@dataclass
|
@@ -80,7 +80,7 @@ class FitParameter:
|
|
80
80
|
"""
|
81
81
|
return not np.isinf(self.minimum) or not np.isinf(self.maximum)
|
82
82
|
|
83
|
-
def copy(self, name: str) ->
|
83
|
+
def copy(self, name: str) -> "FitParameter":
|
84
84
|
"""Create a copy of the parameter object with a new name.
|
85
85
|
|
86
86
|
This is necessary because we define the fit parameters of the actual model as
|
@@ -139,24 +139,24 @@ class FitParameter:
|
|
139
139
|
"""String formatting.
|
140
140
|
"""
|
141
141
|
# Keep in mind Python passes an empty string explicitly when you call
|
142
|
-
# f
|
142
|
+
# f"{parameter}", so we can't really assign a default value to spec.
|
143
143
|
if self.error is not None:
|
144
144
|
param = format(self.ufloat(), spec)
|
145
145
|
if spec.endswith(Format.LATEX):
|
146
|
-
param = f
|
146
|
+
param = f"${param}$"
|
147
147
|
else:
|
148
148
|
spec = spec.rstrip(Format.PRETTY).rstrip(Format.LATEX)
|
149
149
|
param = format(self.value, spec)
|
150
|
-
text = f
|
150
|
+
text = f"{self._name.title()}: {param}"
|
151
151
|
info = []
|
152
152
|
if self._frozen:
|
153
|
-
info.append(
|
153
|
+
info.append("frozen")
|
154
154
|
if not np.isinf(self.minimum):
|
155
|
-
info.append(f
|
155
|
+
info.append(f"min={self.minimum}")
|
156
156
|
if not np.isinf(self.maximum):
|
157
|
-
info.append(f
|
157
|
+
info.append(f"max={self.maximum}")
|
158
158
|
if info:
|
159
|
-
text = f
|
159
|
+
text = f"{text} ({', '.join(info)})"
|
160
160
|
return text
|
161
161
|
|
162
162
|
def __str__(self) -> str:
|
@@ -191,12 +191,12 @@ class FitStatus:
|
|
191
191
|
"""String formatting.
|
192
192
|
"""
|
193
193
|
if self.chisquare is None:
|
194
|
-
return
|
194
|
+
return "N/A"
|
195
195
|
if spec.endswith(Format.LATEX):
|
196
|
-
return f
|
196
|
+
return f"$\\chi^2$ = {self.chisquare:.2f} / {self.dof} dof"
|
197
197
|
if spec.endswith(Format.PRETTY):
|
198
|
-
return f
|
199
|
-
return f
|
198
|
+
return f"χ² = {self.chisquare:.2f} / {self.dof} dof"
|
199
|
+
return f"chisquare = {self.chisquare:.2f} / {self.dof} dof"
|
200
200
|
|
201
201
|
def __str__(self) -> str:
|
202
202
|
"""String formatting.
|
@@ -337,7 +337,7 @@ class AbstractFitModel(ABC):
|
|
337
337
|
# print out an error message.
|
338
338
|
unknown_parameter_names = set(constraints) - set(parameter_names)
|
339
339
|
if unknown_parameter_names:
|
340
|
-
raise ValueError(f
|
340
|
+
raise ValueError(f"Cannot freeze unknown parameters {unknown_parameter_names}")
|
341
341
|
|
342
342
|
# Now we need to build the signature for the new function, starting from a
|
343
343
|
# clean copy of the parameter for the independent variable...
|
@@ -353,8 +353,8 @@ class AbstractFitModel(ABC):
|
|
353
353
|
@functools.wraps(model_function)
|
354
354
|
def wrapper(x, *args):
|
355
355
|
if len(args) != num_free_parameters:
|
356
|
-
raise TypeError(f
|
357
|
-
f
|
356
|
+
raise TypeError(f"Frozen wrapper got {len(args)} parameters instead of " \
|
357
|
+
f"{num_free_parameters} ({free_parameter_names})")
|
358
358
|
parameter_dict = {**dict(zip(free_parameter_names, args)), **constraints}
|
359
359
|
return model_function(x, *[parameter_dict[name] for name in parameter_names])
|
360
360
|
|
@@ -379,7 +379,7 @@ class AbstractFitModel(ABC):
|
|
379
379
|
# (And, since we are at it, make sure we have enough degrees of freedom.)
|
380
380
|
self.status.dof = int(mask.sum() - len(self))
|
381
381
|
if self.status.dof < 0:
|
382
|
-
raise RuntimeError(f
|
382
|
+
raise RuntimeError(f"{self.name()} has no degrees of freedom")
|
383
383
|
xdata = xdata[mask]
|
384
384
|
ydata = ydata[mask]
|
385
385
|
if not isinstance(sigma, Number):
|
@@ -444,10 +444,10 @@ class AbstractFitModel(ABC):
|
|
444
444
|
def __format__(self, spec: str) -> str:
|
445
445
|
"""String formatting.
|
446
446
|
"""
|
447
|
-
text = f
|
447
|
+
text = f"{self.__class__.__name__} ({format(self.status, spec)})\n"
|
448
448
|
for parameter in self._parameters:
|
449
|
-
text = f
|
450
|
-
return text.strip(
|
449
|
+
text = f"{text}{format(parameter, spec)}\n"
|
450
|
+
return text.strip("\n")
|
451
451
|
|
452
452
|
def __str__(self):
|
453
453
|
"""String formatting.
|
aptapy/plotting.py
CHANGED
@@ -27,11 +27,48 @@ DEFAULT_FIGURE_WIDTH = 8.
|
|
27
27
|
DEFAULT_FIGURE_HEIGHT = 6.
|
28
28
|
DEFAULT_FIGURE_SIZE = (DEFAULT_FIGURE_WIDTH, DEFAULT_FIGURE_HEIGHT)
|
29
29
|
DEFAULT_COLOR_CYCLE = [
|
30
|
-
|
31
|
-
|
30
|
+
"#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b",
|
31
|
+
"#e377c2", "#7f7f7f", "#bcbd22", "#17becf"
|
32
32
|
]
|
33
33
|
|
34
34
|
|
35
|
+
def setup_axes(axes, **kwargs):
|
36
|
+
"""Setup a generic axes object.
|
37
|
+
"""
|
38
|
+
if kwargs.get('logx'):
|
39
|
+
axes.set_xscale('log')
|
40
|
+
if kwargs.get('logy'):
|
41
|
+
axes.set_yscale('log')
|
42
|
+
xticks = kwargs.get('xticks')
|
43
|
+
if xticks is not None:
|
44
|
+
axes.set_xticks(xticks)
|
45
|
+
yticks = kwargs.get('yticks')
|
46
|
+
if yticks is not None:
|
47
|
+
axes.set_yticks(yticks)
|
48
|
+
xlabel = kwargs.get('xlabel')
|
49
|
+
if xlabel is not None:
|
50
|
+
axes.set_xlabel(xlabel)
|
51
|
+
ylabel = kwargs.get('ylabel')
|
52
|
+
if ylabel is not None:
|
53
|
+
axes.set_ylabel(ylabel)
|
54
|
+
xmin, xmax, ymin, ymax = [kwargs.get(key) for key in ('xmin', 'xmax', 'ymin', 'ymax')]
|
55
|
+
# Set axis limits individually to avoid passing None to axes.axis()
|
56
|
+
if xmin is not None or xmax is not None:
|
57
|
+
axes.set_xlim(left=xmin, right=xmax)
|
58
|
+
if ymin is not None or ymax is not None:
|
59
|
+
axes.set_ylim(bottom=ymin, top=ymax)
|
60
|
+
if kwargs.get('grids'):
|
61
|
+
axes.grid(which='both')
|
62
|
+
if kwargs.get('legend'):
|
63
|
+
axes.legend()
|
64
|
+
|
65
|
+
|
66
|
+
def setup_gca(**kwargs):
|
67
|
+
"""Setup the axes for the current plot.
|
68
|
+
"""
|
69
|
+
setup_axes(plt.gca(), **kwargs)
|
70
|
+
|
71
|
+
|
35
72
|
def _set(key: str, value: Any):
|
36
73
|
"""Set the value for a single matplotlib parameter.
|
37
74
|
|
@@ -42,9 +79,9 @@ def _set(key: str, value: Any):
|
|
42
79
|
try:
|
43
80
|
matplotlib.rcParams[key] = value
|
44
81
|
except KeyError:
|
45
|
-
logger.warning(f
|
82
|
+
logger.warning(f"Unknown matplotlib rc param {key}, skipping...")
|
46
83
|
except ValueError as exception:
|
47
|
-
logger.warning(f
|
84
|
+
logger.warning(f"{exception}, skipping...")
|
48
85
|
|
49
86
|
|
50
87
|
def configure() -> None:
|
@@ -54,433 +91,433 @@ def configure() -> None:
|
|
54
91
|
# pylint:disable=too-many-statements
|
55
92
|
|
56
93
|
# Backends
|
57
|
-
_set(
|
58
|
-
_set(
|
94
|
+
_set("interactive", False)
|
95
|
+
_set("timezone", "UTC")
|
59
96
|
|
60
97
|
# Lines
|
61
98
|
# See https://matplotlib.org/stable/api/artist_api.html#module-matplotlib.lines
|
62
|
-
_set(
|
63
|
-
_set(
|
64
|
-
_set(
|
65
|
-
_set(
|
66
|
-
_set(
|
67
|
-
_set(
|
68
|
-
_set(
|
69
|
-
_set(
|
70
|
-
_set(
|
71
|
-
_set(
|
72
|
-
_set(
|
73
|
-
_set(
|
74
|
-
_set(
|
99
|
+
_set("lines.linewidth", 1.5) # line width in points
|
100
|
+
_set("lines.linestyle", "-") # solid line
|
101
|
+
_set("lines.color", "C0") # has no affect on plot(); see axes.prop_cycle
|
102
|
+
_set("lines.marker", "None") # the default marker
|
103
|
+
_set("lines.markerfacecolor", "auto") # the default marker face color
|
104
|
+
_set("lines.markeredgecolor", "auto") # the default marker edge color
|
105
|
+
_set("lines.markeredgewidth", 1.0) # the line width around the marker symbol
|
106
|
+
_set("lines.markersize", 6) # marker size, in points
|
107
|
+
_set("lines.dash_joinstyle", "round") # {miter, round, bevel}
|
108
|
+
_set("lines.dash_capstyle", "butt") # {butt, round, projecting}
|
109
|
+
_set("lines.solid_joinstyle", "round") # {miter, round, bevel}
|
110
|
+
_set("lines.solid_capstyle", "projecting") # {butt, round, projecting}
|
111
|
+
_set("lines.antialiased", True) # render lines in antialiased (no jaggies)
|
75
112
|
# The three standard dash patterns. These are scaled by the linewidth.
|
76
|
-
_set(
|
77
|
-
_set(
|
78
|
-
_set(
|
79
|
-
_set(
|
80
|
-
_set(
|
81
|
-
_set(
|
113
|
+
_set("lines.dashed_pattern", (3.7, 1.6))
|
114
|
+
_set("lines.dashdot_pattern", (6.4, 1.6, 1, 1.6))
|
115
|
+
_set("lines.dotted_pattern", (1, 1.65))
|
116
|
+
_set("lines.scale_dashes", True)
|
117
|
+
_set("markers.fillstyle", "full") # {full, left, right, bottom, top, none}
|
118
|
+
_set("pcolor.shading", "auto")
|
82
119
|
# Whether to snap the mesh to pixel boundaries. This is provided solely to allow
|
83
120
|
# old test images to remain unchanged. Set to False to obtain the previous behavior.
|
84
|
-
_set(
|
121
|
+
_set("pcolormesh.snap", True)
|
85
122
|
|
86
123
|
# Patches are graphical objects that fill 2D space, like polygons or circles.
|
87
124
|
# See https://matplotlib.org/stable/api/artist_api.html#module-matplotlib.patches
|
88
|
-
_set(
|
89
|
-
_set(
|
125
|
+
_set("patch.linewidth", 1.0) # edge width in points.
|
126
|
+
_set("patch.facecolor", "C0")
|
90
127
|
# By default, Patches and Collections do not draw edges. This value is only used
|
91
128
|
# if facecolor is "none" (an Artist without facecolor and edgecolor would be
|
92
129
|
# invisible) or if patch.force_edgecolor is True.
|
93
|
-
_set(
|
130
|
+
_set("patch.edgecolor", "black")
|
94
131
|
# By default, Patches and Collections do not draw edges. Set this to True to draw
|
95
132
|
# edges with patch.edgedcolor as the default edgecolor. This is mainly relevant
|
96
133
|
# for styles.
|
97
|
-
_set(
|
98
|
-
_set(
|
134
|
+
_set("patch.force_edgecolor", True)
|
135
|
+
_set("patch.antialiased", True) # render patches in antialiased (no jaggies)
|
99
136
|
|
100
137
|
# Hatches
|
101
|
-
_set(
|
102
|
-
_set(
|
103
|
-
|
104
|
-
# Boxplot---we don
|
105
|
-
_set(
|
106
|
-
_set(
|
107
|
-
_set(
|
108
|
-
_set(
|
109
|
-
_set(
|
110
|
-
_set(
|
111
|
-
_set(
|
112
|
-
_set(
|
113
|
-
_set(
|
114
|
-
_set(
|
115
|
-
_set(
|
116
|
-
_set(
|
117
|
-
_set(
|
118
|
-
_set(
|
119
|
-
_set(
|
120
|
-
_set(
|
121
|
-
_set(
|
122
|
-
_set(
|
123
|
-
_set(
|
124
|
-
_set(
|
125
|
-
_set(
|
126
|
-
_set(
|
127
|
-
_set(
|
128
|
-
_set(
|
129
|
-
_set(
|
130
|
-
_set(
|
131
|
-
_set(
|
132
|
-
_set(
|
133
|
-
_set(
|
134
|
-
_set(
|
135
|
-
_set(
|
136
|
-
_set(
|
137
|
-
_set(
|
138
|
-
_set(
|
139
|
-
_set(
|
140
|
-
_set(
|
141
|
-
_set(
|
138
|
+
_set("hatch.color", "black")
|
139
|
+
_set("hatch.linewidth", 1.0)
|
140
|
+
|
141
|
+
# Boxplot---we don"t really use these much, but you never know...
|
142
|
+
_set("boxplot.notch", False)
|
143
|
+
_set("boxplot.vertical", True)
|
144
|
+
_set("boxplot.whiskers", 1.5)
|
145
|
+
_set("boxplot.bootstrap", None)
|
146
|
+
_set("boxplot.patchartist", False)
|
147
|
+
_set("boxplot.showmeans", False)
|
148
|
+
_set("boxplot.showcaps", True)
|
149
|
+
_set("boxplot.showbox", True)
|
150
|
+
_set("boxplot.showfliers", True)
|
151
|
+
_set("boxplot.meanline", False)
|
152
|
+
_set("boxplot.flierprops.color", "black")
|
153
|
+
_set("boxplot.flierprops.marker", "o")
|
154
|
+
_set("boxplot.flierprops.markerfacecolor", "none")
|
155
|
+
_set("boxplot.flierprops.markeredgecolor", "black")
|
156
|
+
_set("boxplot.flierprops.markeredgewidth", 1.0)
|
157
|
+
_set("boxplot.flierprops.markersize", 6)
|
158
|
+
_set("boxplot.flierprops.linestyle", "none")
|
159
|
+
_set("boxplot.flierprops.linewidth", 1.0)
|
160
|
+
_set("boxplot.boxprops.color", "black")
|
161
|
+
_set("boxplot.boxprops.linewidth", 1.0)
|
162
|
+
_set("boxplot.boxprops.linestyle", "-")
|
163
|
+
_set("boxplot.whiskerprops.color", "black")
|
164
|
+
_set("boxplot.whiskerprops.linewidth", 1.0)
|
165
|
+
_set("boxplot.whiskerprops.linestyle", "-")
|
166
|
+
_set("boxplot.capprops.color", "black")
|
167
|
+
_set("boxplot.capprops.linewidth", 1.0)
|
168
|
+
_set("boxplot.capprops.linestyle", "-")
|
169
|
+
_set("boxplot.medianprops.color", "C1")
|
170
|
+
_set("boxplot.medianprops.linewidth", 1.0)
|
171
|
+
_set("boxplot.medianprops.linestyle", "-")
|
172
|
+
_set("boxplot.meanprops.color", "C2")
|
173
|
+
_set("boxplot.meanprops.marker", "^")
|
174
|
+
_set("boxplot.meanprops.markerfacecolor", "C2")
|
175
|
+
_set("boxplot.meanprops.markeredgecolor", "C2")
|
176
|
+
_set("boxplot.meanprops.markersize", 6)
|
177
|
+
_set("boxplot.meanprops.linestyle", "--")
|
178
|
+
_set("boxplot.meanprops.linewidth", 1.0)
|
142
179
|
|
143
180
|
# The font properties used by `text.Text`.
|
144
181
|
# See https://matplotlib.org/stable/api/font_manager_api.html
|
145
182
|
# Note that for font.serif, font.sans-serif, and font.monospace, the first element
|
146
183
|
# of the list (a DejaVu font) will always be used because DejaVu is shipped with
|
147
184
|
# Matplotlib and is thus guaranteed to be available.
|
148
|
-
_set(
|
149
|
-
_set(
|
150
|
-
_set(
|
185
|
+
_set("font.family", "sans-serif")
|
186
|
+
_set("font.style", "normal") # {normal (or roman), italic, oblique}
|
187
|
+
_set("font.variant", "normal") # {normal, small-caps}
|
151
188
|
# The font.weight property has effectively 13 values: normal, bold, bolder, lighter,
|
152
189
|
# 100, 200, 300, ..., 900. Normal is the same as 400, and bold is 700. bolder and
|
153
190
|
# lighter are relative values with respect to the current weight.
|
154
|
-
_set(
|
155
|
-
_set(
|
191
|
+
_set("font.weight", "normal")
|
192
|
+
_set("font.stretch", "normal") # Currently not implemented.
|
156
193
|
# The font.size property is the default font size for text, given in points. 10 pt
|
157
194
|
# is the standard value. Special text sizes can be defined relative to font.size,
|
158
195
|
# using the following values: xx-small, x-small, small, medium, large, x-large,
|
159
196
|
# xx-large, larger, or smaller
|
160
|
-
_set(
|
197
|
+
_set("font.size", 14.0)
|
161
198
|
|
162
199
|
## The text properties used by `text.Text`.
|
163
200
|
## See https://matplotlib.org/stable/api/artist_api.html#module-matplotlib.text
|
164
|
-
_set(
|
201
|
+
_set("text.color", "black")
|
165
202
|
# FreeType hinting flag {default, no_autohint, force_autohint, no_hinting}
|
166
|
-
_set(
|
203
|
+
_set("text.hinting", "force_autohint")
|
167
204
|
# Specifies the amount of softness for hinting in the horizontal direction.
|
168
205
|
# A value of 1 will hint to full pixels. A value of 2 will hint to half pixels etc.
|
169
|
-
_set(
|
206
|
+
_set("text.hinting_factor", 8)
|
170
207
|
# Specifies the scaling factor for kerning values. This is provided solely to
|
171
208
|
# allow old test images to remain unchanged. Set to 6 to obtain previous behavior.
|
172
209
|
# Values other than 0 or 6 have no defined meaning.
|
173
|
-
_set(
|
174
|
-
_set(
|
210
|
+
_set("text.kerning_factor", 0)
|
211
|
+
_set("text.antialiased", True) # This only affects raster outputs.
|
175
212
|
# Use mathtext if there is an even number of unescaped dollar signs.
|
176
|
-
_set(
|
213
|
+
_set("text.parse_math", True)
|
177
214
|
|
178
215
|
# LaTeX
|
179
216
|
# See https://matplotlib.org/stable/users/explain/text/usetex.html
|
180
|
-
_set(
|
217
|
+
_set("text.usetex", False) # use latex for all text handling.
|
181
218
|
# Font set can be {dejavusans, dejavuserif, cm, stixsans, custom}, where
|
182
219
|
# "custom" is defined by the mathtext.bf, .cal, .it, ..., settings which map
|
183
220
|
# a TeX font name to a fontconfig font pattern.
|
184
|
-
_set(
|
185
|
-
_set(
|
186
|
-
_set(
|
221
|
+
_set("mathtext.fontset", "dejavusans")
|
222
|
+
_set("mathtext.fallback", "cm")
|
223
|
+
_set("mathtext.default", "it")
|
187
224
|
|
188
225
|
# Axes
|
189
226
|
# See https://matplotlib.org/stable/api/axes_api.html#module-matplotlib.axes
|
190
|
-
_set(
|
191
|
-
_set(
|
192
|
-
_set(
|
193
|
-
_set(
|
194
|
-
_set(
|
195
|
-
_set(
|
196
|
-
_set(
|
197
|
-
_set(
|
198
|
-
_set(
|
227
|
+
_set("axes.facecolor", "white") # axes background color
|
228
|
+
_set("axes.edgecolor", "black") # axes edge color
|
229
|
+
_set("axes.linewidth", 1.2) # edge line width
|
230
|
+
_set("axes.grid", True) # display grid or not
|
231
|
+
_set("axes.grid.axis", "both") # which axis the grid should apply to
|
232
|
+
_set("axes.grid.which", "major") # grid lines at {major, minor, both} ticks
|
233
|
+
_set("axes.titlelocation", "center") # alignment of the title: {left, right, center}
|
234
|
+
_set("axes.titlesize", "large") # font size of the axes title
|
235
|
+
_set("axes.titleweight", "normal") # font weight of title
|
199
236
|
# Color of the axes title, auto falls back tO text.color as default value
|
200
|
-
_set(
|
201
|
-
_set(
|
202
|
-
_set(
|
203
|
-
_set(
|
204
|
-
_set(
|
205
|
-
_set(
|
206
|
-
_set(
|
237
|
+
_set("axes.titlecolor", "auto")
|
238
|
+
_set("axes.titley", None) # position title (axes relative units). None implies auto
|
239
|
+
_set("axes.titlepad", 6.0) # pad between axes and title in points
|
240
|
+
_set("axes.labelsize", "medium") # font size of the x and y labels
|
241
|
+
_set("axes.labelpad", 4.0) # space between label and axis
|
242
|
+
_set("axes.labelweight", "normal") # weight of the x and y labels
|
243
|
+
_set("axes.labelcolor", "black")
|
207
244
|
# Draw axis gridlines and ticks:
|
208
245
|
# - below patches (True)
|
209
|
-
# - above patches but below lines (
|
246
|
+
# - above patches but below lines ("line")
|
210
247
|
# - above all (False)
|
211
|
-
_set(
|
248
|
+
_set("axes.axisbelow", "line")
|
212
249
|
# Use scientific notation if log10 of the axis range is smaller than the
|
213
250
|
# first or larger than the second
|
214
|
-
_set(
|
215
|
-
_set(
|
251
|
+
_set("axes.formatter.limits", (-5, 6))
|
252
|
+
_set("axes.formatter.use_locale", False)
|
216
253
|
# When True, use mathtext for scientific notation.
|
217
|
-
_set(
|
254
|
+
_set("axes.formatter.use_mathtext", False)
|
218
255
|
# Minimum exponent to format in scientific notation
|
219
|
-
_set(
|
256
|
+
_set("axes.formatter.min_exponent", 0)
|
220
257
|
# If True, the tick label formatter will default to labeling ticks relative
|
221
258
|
# to an offset when the data range is small compared to the minimum absolute
|
222
259
|
# value of the data.
|
223
|
-
_set(
|
260
|
+
_set("axes.formatter.useoffset", True)
|
224
261
|
# When useoffset is True, the offset will be used when it can remove
|
225
262
|
# at least this number of significant digits from tick labels.
|
226
|
-
_set(
|
227
|
-
_set(
|
228
|
-
_set(
|
229
|
-
_set(
|
230
|
-
_set(
|
263
|
+
_set("axes.formatter.offset_threshold", 4)
|
264
|
+
_set("axes.spines.left", True) # display axis spines
|
265
|
+
_set("axes.spines.bottom", True)
|
266
|
+
_set("axes.spines.top", True)
|
267
|
+
_set("axes.spines.right", True)
|
231
268
|
# use Unicode for the minus symbol rather than hyphen. See
|
232
269
|
# https://en.wikipedia.org/wiki/Plus_and_minus_signs#Character_codes
|
233
|
-
_set(
|
234
|
-
_set(
|
235
|
-
_set(
|
236
|
-
_set(
|
237
|
-
_set(
|
270
|
+
_set("axes.unicode_minus", True)
|
271
|
+
_set("axes.prop_cycle", cycler("color", DEFAULT_COLOR_CYCLE))
|
272
|
+
_set("axes.xmargin", .05) # x margin. See `axes.Axes.margins`
|
273
|
+
_set("axes.ymargin", .05) # y margin. See `axes.Axes.margins`
|
274
|
+
_set("axes.zmargin", .05) # z margin. See `axes.Axes.margins`
|
238
275
|
# If "data", use axes.xmargin and axes.ymargin as is.
|
239
276
|
# If "round_numbers", after application of margins, axis limits are further expanded
|
240
277
|
# to the nearest "round" number.
|
241
|
-
_set(
|
242
|
-
_set(
|
243
|
-
_set(
|
278
|
+
_set("axes.autolimit_mode", "data")
|
279
|
+
_set("polaraxes.grid", True) # display grid on polar axes
|
280
|
+
_set("axes3d.grid", True) # display grid on 3D axes
|
244
281
|
# Automatically add margin when manually setting 3D axis limits
|
245
|
-
_set(
|
246
|
-
_set(
|
247
|
-
_set(
|
248
|
-
_set(
|
249
|
-
_set(
|
250
|
-
_set(
|
251
|
-
# trackball border width, in units of the Axes bbox (only for
|
252
|
-
_set(
|
282
|
+
_set("axes3d.automargin", False)
|
283
|
+
_set("axes3d.xaxis.panecolor", (0.95, 0.95, 0.95, 0.5)) # background pane on 3D axes
|
284
|
+
_set("axes3d.yaxis.panecolor", (0.90, 0.90, 0.90, 0.5)) # background pane on 3D axes
|
285
|
+
_set("axes3d.zaxis.panecolor", (0.925, 0.925, 0.925, 0.5)) # background pane on 3D axes
|
286
|
+
_set("axes3d.mouserotationstyle", "arcball") # {azel, trackball, sphere, arcball}
|
287
|
+
_set("axes3d.trackballsize", 0.667) # trackball diameter, in units of the Axes bbox
|
288
|
+
# trackball border width, in units of the Axes bbox (only for "sphere" and "arcball" style)
|
289
|
+
_set("axes3d.trackballborder", 0.2)
|
253
290
|
|
254
291
|
# Axis
|
255
|
-
_set(
|
256
|
-
_set(
|
292
|
+
_set("xaxis.labellocation", "center") # {left, right, center}
|
293
|
+
_set("yaxis.labellocation", "center") # {bottom, top, center}
|
257
294
|
|
258
295
|
# Dates
|
259
296
|
# These control the default format strings used in AutoDateFormatter.
|
260
|
-
_set(
|
261
|
-
_set(
|
262
|
-
_set(
|
263
|
-
_set(
|
264
|
-
_set(
|
265
|
-
_set(
|
266
|
-
_set(
|
267
|
-
# The reference date for Matplotlib
|
297
|
+
_set("date.autoformatter.year", "%Y")
|
298
|
+
_set("date.autoformatter.month", "%Y-%m")
|
299
|
+
_set("date.autoformatter.day", "%Y-%m-%d")
|
300
|
+
_set("date.autoformatter.hour", "%m-%d %H")
|
301
|
+
_set("date.autoformatter.minute", "%d %H:%M")
|
302
|
+
_set("date.autoformatter.second", "%H:%M:%S")
|
303
|
+
_set("date.autoformatter.microsecond", "%M:%S.%f")
|
304
|
+
# The reference date for Matplotlib"s internal date representation
|
268
305
|
# See https://matplotlib.org/stable/gallery/ticks/date_precision_and_epochs.html
|
269
|
-
_set(
|
270
|
-
_set(
|
306
|
+
_set("date.epoch", "1970-01-01T00:00:00")
|
307
|
+
_set("date.converter", "auto") # {auto, concise}
|
271
308
|
# For auto converter whether to use interval_multiples:
|
272
|
-
_set(
|
309
|
+
_set("date.interval_multiples", True)
|
273
310
|
|
274
311
|
# Ticks
|
275
312
|
# See https://matplotlib.org/stable/api/axis_api.html#matplotlib.axis.Tick
|
276
|
-
_set(
|
277
|
-
_set(
|
278
|
-
_set(
|
279
|
-
_set(
|
280
|
-
_set(
|
281
|
-
_set(
|
282
|
-
_set(
|
283
|
-
_set(
|
284
|
-
_set(
|
285
|
-
_set(
|
286
|
-
_set(
|
313
|
+
_set("xtick.top", False) # draw ticks on the top side
|
314
|
+
_set("xtick.bottom", True) # draw ticks on the bottom side
|
315
|
+
_set("xtick.labeltop", False) # draw label on the top
|
316
|
+
_set("xtick.labelbottom", True) # draw label on the bottom
|
317
|
+
_set("xtick.major.size", 3.5) # major tick size in points
|
318
|
+
_set("xtick.minor.size", 2) # minor tick size in points
|
319
|
+
_set("xtick.major.width", 0.8) # major tick width in points
|
320
|
+
_set("xtick.minor.width", 0.6) # minor tick width in points
|
321
|
+
_set("xtick.major.pad", 3.5) # distance to major tick label in points
|
322
|
+
_set("xtick.minor.pad", 3.4) # distance to the minor tick label in points
|
323
|
+
_set("xtick.color", "black") # color of the ticks
|
287
324
|
# Color of the tick labels or inherit from xtick.color
|
288
|
-
_set(
|
289
|
-
_set(
|
290
|
-
_set(
|
291
|
-
_set(
|
292
|
-
_set(
|
293
|
-
_set(
|
294
|
-
_set(
|
295
|
-
_set(
|
296
|
-
_set(
|
297
|
-
_set(
|
298
|
-
_set(
|
299
|
-
_set(
|
300
|
-
_set(
|
301
|
-
_set(
|
302
|
-
_set(
|
303
|
-
_set(
|
304
|
-
_set(
|
305
|
-
_set(
|
306
|
-
_set(
|
307
|
-
_set(
|
308
|
-
_set(
|
309
|
-
_set(
|
310
|
-
_set(
|
311
|
-
_set(
|
312
|
-
_set(
|
313
|
-
_set(
|
314
|
-
_set(
|
315
|
-
_set(
|
316
|
-
_set(
|
317
|
-
_set(
|
318
|
-
_set(
|
325
|
+
_set("xtick.labelcolor", "inherit")
|
326
|
+
_set("xtick.labelsize", "medium") # font size of the tick labels
|
327
|
+
_set("xtick.direction", "out") # direction: {in, out, inout}
|
328
|
+
_set("xtick.minor.visible", False) # visibility of minor ticks on x-axis
|
329
|
+
_set("xtick.major.top", True) # draw x axis top major ticks
|
330
|
+
_set("xtick.major.bottom", True) # draw x axis bottom major ticks
|
331
|
+
_set("xtick.minor.top", True) # draw x axis top minor ticks
|
332
|
+
_set("xtick.minor.bottom", True) # draw x axis bottom minor ticks
|
333
|
+
_set("xtick.minor.ndivs", "auto") # number of minor ticks between the major ticks on x-axis
|
334
|
+
_set("xtick.alignment", "center") # alignment of xticks
|
335
|
+
_set("ytick.left", True) # draw ticks on the left side
|
336
|
+
_set("ytick.right", False) # draw ticks on the right side
|
337
|
+
_set("ytick.labelleft", True) # draw tick labels on the left side
|
338
|
+
_set("ytick.labelright", False) # draw tick labels on the right side
|
339
|
+
_set("ytick.major.size", 3.5) # major tick size in points
|
340
|
+
_set("ytick.minor.size", 2) # minor tick size in points
|
341
|
+
_set("ytick.major.width", 0.8) # major tick width in points
|
342
|
+
_set("ytick.minor.width", 0.6) # minor tick width in points
|
343
|
+
_set("ytick.major.pad", 3.5) # distance to major tick label in points
|
344
|
+
_set("ytick.minor.pad", 3.4) # distance to the minor tick label in points
|
345
|
+
_set("ytick.color", "black") # color of the ticks
|
346
|
+
_set("ytick.labelcolor", "inherit") # color of the tick labels or inherit from ytick.color
|
347
|
+
_set("ytick.labelsize", "medium") # font size of the tick labels
|
348
|
+
_set("ytick.direction", "out") # direction: {in, out, inout}
|
349
|
+
_set("ytick.minor.visible", False) # visibility of minor ticks on y-axis
|
350
|
+
_set("ytick.major.left", True) # draw y axis left major ticks
|
351
|
+
_set("ytick.major.right", True) # draw y axis right major ticks
|
352
|
+
_set("ytick.minor.left", True) # draw y axis left minor ticks
|
353
|
+
_set("ytick.minor.right", True) # draw y axis right minor ticks
|
354
|
+
_set("ytick.minor.ndivs", "auto") # number of minor ticks between the major ticks on y-axis
|
355
|
+
_set("ytick.alignment", "center_baseline") # alignment of yticks
|
319
356
|
|
320
357
|
# Grids
|
321
|
-
_set(
|
322
|
-
_set(
|
323
|
-
_set(
|
324
|
-
_set(
|
358
|
+
_set("grid.color", "#c0c0c0") # grid color
|
359
|
+
_set("grid.linestyle", "--") # line style
|
360
|
+
_set("grid.linewidth", 0.8) # in points
|
361
|
+
_set("grid.alpha", 0.8) # transparency, between 0.0 and 1.0
|
325
362
|
|
326
363
|
|
327
364
|
# Legends
|
328
|
-
_set(
|
329
|
-
_set(
|
330
|
-
_set(
|
331
|
-
_set(
|
332
|
-
_set(
|
365
|
+
_set("legend.loc", "best")
|
366
|
+
_set("legend.frameon", True) # if True, draw the legend on a background patch
|
367
|
+
_set("legend.framealpha", 0.75) # legend patch transparency
|
368
|
+
_set("legend.facecolor", "inherit") # inherit from axes.facecolor; or color spec
|
369
|
+
_set("legend.edgecolor", "#a0a0a0") # background patch boundary color
|
333
370
|
# If True, use a rounded box for the legend background, else a rectangle
|
334
|
-
_set(
|
335
|
-
_set(
|
336
|
-
_set(
|
337
|
-
_set(
|
338
|
-
_set(
|
339
|
-
_set(
|
340
|
-
_set(
|
341
|
-
_set(
|
371
|
+
_set("legend.fancybox", True)
|
372
|
+
_set("legend.shadow", False) # if True, give background a shadow effect
|
373
|
+
_set("legend.numpoints", 1) # the number of marker points in the legend line
|
374
|
+
_set("legend.scatterpoints", 1) # number of scatter points
|
375
|
+
_set("legend.markerscale", 1.0) # the relative size of legend markers vs. original
|
376
|
+
_set("legend.fontsize", "small")
|
377
|
+
_set("legend.labelcolor", None)
|
378
|
+
_set("legend.title_fontsize", None) # None sets to the same as the default axes.
|
342
379
|
# Dimensions as fraction of font size:
|
343
|
-
_set(
|
344
|
-
_set(
|
345
|
-
_set(
|
346
|
-
_set(
|
347
|
-
_set(
|
348
|
-
_set(
|
349
|
-
_set(
|
380
|
+
_set("legend.borderpad", 0.4) # border whitespace
|
381
|
+
_set("legend.labelspacing", 0.5) # the vertical space between the legend entries
|
382
|
+
_set("legend.handlelength", 2.0) # the length of the legend lines
|
383
|
+
_set("legend.handleheight", 0.7) # the height of the legend handle
|
384
|
+
_set("legend.handletextpad", 0.8) # the space between the legend line and legend text
|
385
|
+
_set("legend.borderaxespad", 0.5) # the border between the axes and legend edge
|
386
|
+
_set("legend.columnspacing", 2.0) # column separation
|
350
387
|
|
351
388
|
# Figures
|
352
389
|
## See https://matplotlib.org/stable/api/figure_api.html#matplotlib.figure.Figure
|
353
|
-
_set(
|
354
|
-
_set(
|
355
|
-
_set(
|
356
|
-
_set(
|
357
|
-
_set(
|
358
|
-
_set(
|
359
|
-
_set(
|
360
|
-
_set(
|
361
|
-
_set(
|
362
|
-
_set(
|
363
|
-
_set(
|
390
|
+
_set("figure.titlesize", "large") # size of the figure title
|
391
|
+
_set("figure.titleweight", "normal") # weight of the figure title
|
392
|
+
_set("figure.labelsize", "large") # size of the figure label
|
393
|
+
_set("figure.labelweight", "normal") # weight of the figure label
|
394
|
+
_set("figure.figsize", DEFAULT_FIGURE_SIZE) # figure size in inches
|
395
|
+
_set("figure.dpi", 100) # figure dots per inch
|
396
|
+
_set("figure.facecolor", "white") # figure face color
|
397
|
+
_set("figure.edgecolor", "white") # figure edge color
|
398
|
+
_set("figure.frameon", True) # enable figure frame
|
399
|
+
_set("figure.max_open_warning", 20)
|
400
|
+
_set("figure.raise_window", True) # Raise the GUI window to front when show() is called
|
364
401
|
# The figure subplot parameters.
|
365
402
|
# All dimensions are a fraction of the figure width and height.
|
366
|
-
_set(
|
367
|
-
_set(
|
368
|
-
_set(
|
369
|
-
_set(
|
403
|
+
_set("figure.subplot.left", 0.125) # the left side of the subplots of the figure
|
404
|
+
_set("figure.subplot.right", 0.97) # the right side of the subplots of the figure
|
405
|
+
_set("figure.subplot.bottom", 0.11) # the bottom of the subplots of the figure
|
406
|
+
_set("figure.subplot.top", 0.96) # the top of the subplots of the figure
|
370
407
|
# Amount of width reserved for space between subplots, expressed as a fraction
|
371
408
|
# of the average axis width.
|
372
|
-
_set(
|
409
|
+
_set("figure.subplot.wspace", 0.2)
|
373
410
|
# Amount of height reserved for space between subplots, expressed as a fraction
|
374
411
|
# of the average axis height
|
375
|
-
_set(
|
412
|
+
_set("figure.subplot.hspace", 0.2)
|
376
413
|
# When True, automatically adjust subplot parameters to make the plot fit the figure
|
377
414
|
# using `tight_layout`
|
378
|
-
_set(
|
415
|
+
_set("figure.autolayout", False)
|
379
416
|
# When True, automatically make plot elements fit on the figure.
|
380
417
|
# (Not compatible with `autolayout`, above).
|
381
|
-
_set(
|
418
|
+
_set("figure.constrained_layout.use", False)
|
382
419
|
# Padding (in inches) around axes; defaults to 3/72 inches, i.e. 3 points.
|
383
|
-
_set(
|
384
|
-
_set(
|
420
|
+
_set("figure.constrained_layout.h_pad", 0.04167)
|
421
|
+
_set("figure.constrained_layout.w_pad", 0.04167)
|
385
422
|
# Spacing between subplots, relative to the subplot sizes. Much smaller than for
|
386
423
|
# tight_layout (figure.subplot.hspace, figure.subplot.wspace) as constrained_layout
|
387
424
|
# already takes surrounding texts (titles, labels, # ticklabels) into account.
|
388
|
-
_set(
|
389
|
-
_set(
|
425
|
+
_set("figure.constrained_layout.hspace", 0.02)
|
426
|
+
_set("figure.constrained_layout.wspace", 0.02)
|
390
427
|
|
391
428
|
# Images
|
392
|
-
_set(
|
393
|
-
_set(
|
394
|
-
_set(
|
395
|
-
_set(
|
396
|
-
_set(
|
397
|
-
_set(
|
398
|
-
_set(
|
429
|
+
_set("image.aspect", "equal") # {equal, auto} or a number
|
430
|
+
_set("image.interpolation", "auto") # see help(imshow) for options
|
431
|
+
_set("image.interpolation_stage", "auto") # see help(imshow) for options
|
432
|
+
_set("image.cmap", "viridis") # A colormap name (plasma, magma, etc.)
|
433
|
+
_set("image.lut", 256) # the size of the colormap lookup table
|
434
|
+
_set("image.origin", "upper") # {lower, upper}
|
435
|
+
_set("image.resample", True)
|
399
436
|
# When True, all the images on a set of axes are combined into a single composite
|
400
437
|
# image before saving a figure as a vector graphics file, such as a PDF.
|
401
|
-
_set(
|
438
|
+
_set("image.composite_image", True)
|
402
439
|
|
403
440
|
# Various plots.
|
404
|
-
_set(
|
405
|
-
_set(
|
406
|
-
_set(
|
407
|
-
_set(
|
408
|
-
_set(
|
409
|
-
_set(
|
410
|
-
_set(
|
411
|
-
_set(
|
441
|
+
_set("contour.negative_linestyle", "dashed") # string or on-off ink sequence
|
442
|
+
_set("contour.corner_mask", True) # {True, False}
|
443
|
+
_set("contour.linewidth", None)
|
444
|
+
_set("contour.algorithm", "mpl2014") # {mpl2005, mpl2014, serial, threaded}
|
445
|
+
_set("errorbar.capsize", 0) # length of end cap on error bars in pixels
|
446
|
+
_set("hist.bins", 10) # The default number of histogram bins or "auto".
|
447
|
+
_set("scatter.marker", "o") # The default marker type for scatter plots.
|
448
|
+
_set("scatter.edgecolors", "face") # The default edge colors for scatter plots.
|
412
449
|
|
413
450
|
# Paths
|
414
451
|
# When True, simplify paths by removing "invisible" points to reduce file size
|
415
452
|
# and increase rendering speed
|
416
|
-
_set(
|
453
|
+
_set("path.simplify", True)
|
417
454
|
# The threshold of similarity below which vertices will be removed in
|
418
455
|
# the simplification process.
|
419
|
-
_set(
|
456
|
+
_set("path.simplify_threshold", 0.111111111111)
|
420
457
|
# When True, rectilinear axis-aligned paths will be snapped to the nearest pixel
|
421
458
|
# when certain criteria are met. When False, paths will never be snapped.
|
422
|
-
_set(
|
459
|
+
_set("path.snap", True)
|
423
460
|
# May be None, or a tuple of the form: path.sketch: (scale, length, randomness)
|
424
461
|
# - scale is the amplitude of the wiggle perpendicular to the line (in pixels).
|
425
462
|
# - length is the length of the wiggle along the line (in pixels).
|
426
463
|
# - randomness is the factor by which the length is randomly scaled.
|
427
|
-
_set(
|
464
|
+
_set("path.sketch", None)
|
428
465
|
|
429
466
|
# Saving figures...
|
430
467
|
# The default savefig parameters can be different from the display parameters
|
431
|
-
_set(
|
432
|
-
_set(
|
433
|
-
_set(
|
434
|
-
_set(
|
435
|
-
_set(
|
436
|
-
_set(
|
468
|
+
_set("savefig.dpi", 300) # figure dots per inch or "figure"
|
469
|
+
_set("savefig.facecolor", "auto") # figure face color when saving
|
470
|
+
_set("savefig.edgecolor", "auto") # figure edge color when saving
|
471
|
+
_set("savefig.format", "png") # {png, ps, pdf, svg}
|
472
|
+
_set("savefig.bbox", "standard") # {tight, standard}
|
473
|
+
_set("savefig.pad_inches", 0.1) # padding to be used, when bbox is set to "tight"
|
437
474
|
# Default directory in savefig dialog, gets updated after interactive saves,
|
438
|
-
# unless set to the empty string (i.e. the current directory); use
|
475
|
+
# unless set to the empty string (i.e. the current directory); use "." to start
|
439
476
|
# at the current directory but update after interactive saves
|
440
|
-
_set(
|
477
|
+
_set("savefig.directory", "")
|
441
478
|
# Whether figures are saved with a transparent background by default
|
442
|
-
_set(
|
479
|
+
_set("savefig.transparent", False)
|
443
480
|
# Orientation of saved figure, for PostScript output only
|
444
|
-
_set(
|
445
|
-
_set(
|
446
|
-
_set(
|
481
|
+
_set("savefig.orientation", "portrait")
|
482
|
+
_set("macosx.window_mode", "system")
|
483
|
+
_set("tk.window_focus", False) # Maintain shell focus for TkAgg
|
447
484
|
# Integer from 0 to 9, 0 disables compression (good for debugging)
|
448
|
-
_set(
|
449
|
-
_set(
|
450
|
-
_set(
|
451
|
-
_set(
|
452
|
-
_set(
|
485
|
+
_set("pdf.compression", 6)
|
486
|
+
_set("pdf.fonttype", 3) # Output Type 3 (Type3) or Type 42 (TrueType)
|
487
|
+
_set("pdf.use14corefonts", False)
|
488
|
+
_set("pdf.inheritcolor", False)
|
489
|
+
_set("svg.image_inline", True) # Write raster image data directly into the SVG file
|
453
490
|
# How to handle SVG fonts:
|
454
491
|
# - path: embed characters as paths -- supported by most SVG renderers
|
455
492
|
# - None: assume fonts are installed on the machine where the SVG will be viewed.
|
456
|
-
_set(
|
457
|
-
_set(
|
493
|
+
_set("svg.fonttype", "path")
|
494
|
+
_set("svg.hashsalt", None) # If not None, use this string as hash salt instead of uuid4
|
458
495
|
# If not None, use this string as the value for the `id` attribute in the top <svg> tag
|
459
|
-
_set(
|
496
|
+
_set("svg.id", None)
|
460
497
|
# See https://matplotlib.org/stable/tutorials/text/pgf.html for more information.
|
461
|
-
_set(
|
462
|
-
_set(
|
463
|
-
_set(
|
498
|
+
_set("pgf.rcfonts", True)
|
499
|
+
_set("pgf.texsystem", "xelatex")
|
500
|
+
_set("docstring.hardcopy", False) # set this when you want to generate hardcopy docstring
|
464
501
|
|
465
502
|
# Animations
|
466
503
|
# How to display the animation as HTML in the IPython notebook:
|
467
|
-
# -
|
468
|
-
# -
|
469
|
-
_set(
|
470
|
-
_set(
|
471
|
-
_set(
|
504
|
+
# - "html5" uses HTML5 video tag
|
505
|
+
# - "jshtml" creates a JavaScript animation
|
506
|
+
_set("animation.html", "none")
|
507
|
+
_set("animation.writer", "ffmpeg") # MovieWriter "backend" to use
|
508
|
+
_set("animation.codec", "h264") # Codec to use for writing movie
|
472
509
|
# Controls size/quality trade-off for movie.
|
473
510
|
# -1 implies let utility auto-determine
|
474
|
-
_set(
|
475
|
-
_set(
|
511
|
+
_set("animation.bitrate", -1)
|
512
|
+
_set("animation.frame_format", "png") # Controls frame format used by temp files
|
476
513
|
# Path to ffmpeg binary. Unqualified paths are resolved by subprocess.Popen.
|
477
|
-
_set(
|
478
|
-
# Path to ImageMagick
|
514
|
+
_set("animation.ffmpeg_path", "ffmpeg")
|
515
|
+
# Path to ImageMagick"s convert binary. Unqualified paths are resolved by
|
479
516
|
# subprocess.Popen, except that on Windows, we look up an install of
|
480
517
|
# ImageMagick in the registry (as convert is also the name of a system tool).
|
481
|
-
_set(
|
518
|
+
_set("animation.convert_path", "convert")
|
482
519
|
# Limit, in MB, of size of base64 encoded animation in HTML (i.e. IPython notebook)
|
483
|
-
_set(
|
520
|
+
_set("animation.embed_limit", 20.0)
|
484
521
|
|
485
522
|
|
486
523
|
configure()
|
@@ -0,0 +1,11 @@
|
|
1
|
+
aptapy/__init__.py,sha256=a7Au1ukdeJbjiIZ-UL-qZE1xk-d2WnKKkoqjg_0SzqA,1707
|
2
|
+
aptapy/_version.py,sha256=Zn1KFblwuFHiDRdRAiRnDBRkbPttWh44jKa5zG2ov0E,22
|
3
|
+
aptapy/hist.py,sha256=5fiaYEnSQ7b_jSsZdRvXrIGr2vTMlW_55jkFpE8L3Sw,8158
|
4
|
+
aptapy/modeling.py,sha256=V8DVfmwFyUfy9-YZXd9Hz5rlyGEy12xoyn-oJ4ss3W0,18236
|
5
|
+
aptapy/plotting.py,sha256=ZixAVF83qIuITjzQJBUvMNCK-REilzyAt0vxgcMbCOk,27125
|
6
|
+
aptapy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
|
+
aptapy/typing_.py,sha256=JIbEqKI8kn_fd90yDt0JmI1AojjmLhAEB_1RfMFxLx4,807
|
8
|
+
aptapy-0.2.0.dist-info/METADATA,sha256=yvpj0nK8DKrbXcccDPqKeiruxJYAGEK0FYaIKa4UpS0,41456
|
9
|
+
aptapy-0.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
10
|
+
aptapy-0.2.0.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
11
|
+
aptapy-0.2.0.dist-info/RECORD,,
|
aptapy-0.1.1.dist-info/RECORD
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
aptapy/__init__.py,sha256=a7Au1ukdeJbjiIZ-UL-qZE1xk-d2WnKKkoqjg_0SzqA,1707
|
2
|
-
aptapy/_version.py,sha256=rnObPjuBcEStqSO0S6gsdS_ot8ITOQjVj_-P1LUUYpg,22
|
3
|
-
aptapy/modeling.py,sha256=Ba-kHfvwjSc5oM3XZGsxN5wAONQZaKmICQa-P65qxNE,18234
|
4
|
-
aptapy/plotting.py,sha256=Pv0uo7fqoKYmyFmX2CiSRujzTkYNKiUsW7ZHSBWQowE,25991
|
5
|
-
aptapy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
|
-
aptapy/typing_.py,sha256=JIbEqKI8kn_fd90yDt0JmI1AojjmLhAEB_1RfMFxLx4,807
|
7
|
-
aptapy-0.1.1.dist-info/METADATA,sha256=bJ44czUH6kc516OHBIbge9neKPWTm3jAyz2fBEvPUkY,41456
|
8
|
-
aptapy-0.1.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
9
|
-
aptapy-0.1.1.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
10
|
-
aptapy-0.1.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|