aptapy 0.1.1__py3-none-any.whl → 0.3.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 +280 -0
- aptapy/modeling.py +576 -96
- aptapy/plotting.py +334 -290
- aptapy/strip.py +92 -0
- {aptapy-0.1.1.dist-info → aptapy-0.3.0.dist-info}/METADATA +10 -2
- aptapy-0.3.0.dist-info/RECORD +12 -0
- aptapy-0.1.1.dist-info/RECORD +0 -10
- {aptapy-0.1.1.dist-info → aptapy-0.3.0.dist-info}/WHEEL +0 -0
- {aptapy-0.1.1.dist-info → aptapy-0.3.0.dist-info}/licenses/LICENSE +0 -0
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,445 +79,452 @@ 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
|
-
def configure() -> None:
|
87
|
+
def configure(*args) -> None:
|
51
88
|
"""See https://matplotlib.org/stable/users/explain/customizing.html for more
|
52
89
|
information.
|
90
|
+
|
91
|
+
.. note::
|
92
|
+
|
93
|
+
Note that this function can be used as a hook by Sphinx Gallery to
|
94
|
+
configure the plotting environment for each example, so that the matplotlib
|
95
|
+
configuration is consistent across all examples and is not reset each time.
|
96
|
+
This is the reason why the function signature includes unused arguments.
|
53
97
|
"""
|
54
|
-
# pylint:disable=too-many-statements
|
98
|
+
# pylint:disable=too-many-statements, unused-argument
|
55
99
|
|
56
100
|
# Backends
|
57
|
-
_set(
|
58
|
-
_set(
|
101
|
+
_set("interactive", False)
|
102
|
+
_set("timezone", "UTC")
|
59
103
|
|
60
104
|
# Lines
|
61
105
|
# 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(
|
106
|
+
_set("lines.linewidth", 1.5) # line width in points
|
107
|
+
_set("lines.linestyle", "-") # solid line
|
108
|
+
_set("lines.color", "C0") # has no affect on plot(); see axes.prop_cycle
|
109
|
+
_set("lines.marker", "None") # the default marker
|
110
|
+
_set("lines.markerfacecolor", "auto") # the default marker face color
|
111
|
+
_set("lines.markeredgecolor", "auto") # the default marker edge color
|
112
|
+
_set("lines.markeredgewidth", 1.0) # the line width around the marker symbol
|
113
|
+
_set("lines.markersize", 6) # marker size, in points
|
114
|
+
_set("lines.dash_joinstyle", "round") # {miter, round, bevel}
|
115
|
+
_set("lines.dash_capstyle", "butt") # {butt, round, projecting}
|
116
|
+
_set("lines.solid_joinstyle", "round") # {miter, round, bevel}
|
117
|
+
_set("lines.solid_capstyle", "projecting") # {butt, round, projecting}
|
118
|
+
_set("lines.antialiased", True) # render lines in antialiased (no jaggies)
|
75
119
|
# The three standard dash patterns. These are scaled by the linewidth.
|
76
|
-
_set(
|
77
|
-
_set(
|
78
|
-
_set(
|
79
|
-
_set(
|
80
|
-
_set(
|
81
|
-
_set(
|
120
|
+
_set("lines.dashed_pattern", (3.7, 1.6))
|
121
|
+
_set("lines.dashdot_pattern", (6.4, 1.6, 1, 1.6))
|
122
|
+
_set("lines.dotted_pattern", (1, 1.65))
|
123
|
+
_set("lines.scale_dashes", True)
|
124
|
+
_set("markers.fillstyle", "full") # {full, left, right, bottom, top, none}
|
125
|
+
_set("pcolor.shading", "auto")
|
82
126
|
# Whether to snap the mesh to pixel boundaries. This is provided solely to allow
|
83
127
|
# old test images to remain unchanged. Set to False to obtain the previous behavior.
|
84
|
-
_set(
|
128
|
+
_set("pcolormesh.snap", True)
|
85
129
|
|
86
130
|
# Patches are graphical objects that fill 2D space, like polygons or circles.
|
87
131
|
# See https://matplotlib.org/stable/api/artist_api.html#module-matplotlib.patches
|
88
|
-
_set(
|
89
|
-
_set(
|
132
|
+
_set("patch.linewidth", 1.0) # edge width in points.
|
133
|
+
_set("patch.facecolor", "C0")
|
90
134
|
# By default, Patches and Collections do not draw edges. This value is only used
|
91
135
|
# if facecolor is "none" (an Artist without facecolor and edgecolor would be
|
92
136
|
# invisible) or if patch.force_edgecolor is True.
|
93
|
-
_set(
|
137
|
+
_set("patch.edgecolor", "black")
|
94
138
|
# By default, Patches and Collections do not draw edges. Set this to True to draw
|
95
139
|
# edges with patch.edgedcolor as the default edgecolor. This is mainly relevant
|
96
140
|
# for styles.
|
97
|
-
_set(
|
98
|
-
_set(
|
141
|
+
_set("patch.force_edgecolor", True)
|
142
|
+
_set("patch.antialiased", True) # render patches in antialiased (no jaggies)
|
99
143
|
|
100
144
|
# 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(
|
145
|
+
_set("hatch.color", "black")
|
146
|
+
_set("hatch.linewidth", 1.0)
|
147
|
+
|
148
|
+
# Boxplot---we don"t really use these much, but you never know...
|
149
|
+
_set("boxplot.notch", False)
|
150
|
+
_set("boxplot.vertical", True)
|
151
|
+
_set("boxplot.whiskers", 1.5)
|
152
|
+
_set("boxplot.bootstrap", None)
|
153
|
+
_set("boxplot.patchartist", False)
|
154
|
+
_set("boxplot.showmeans", False)
|
155
|
+
_set("boxplot.showcaps", True)
|
156
|
+
_set("boxplot.showbox", True)
|
157
|
+
_set("boxplot.showfliers", True)
|
158
|
+
_set("boxplot.meanline", False)
|
159
|
+
_set("boxplot.flierprops.color", "black")
|
160
|
+
_set("boxplot.flierprops.marker", "o")
|
161
|
+
_set("boxplot.flierprops.markerfacecolor", "none")
|
162
|
+
_set("boxplot.flierprops.markeredgecolor", "black")
|
163
|
+
_set("boxplot.flierprops.markeredgewidth", 1.0)
|
164
|
+
_set("boxplot.flierprops.markersize", 6)
|
165
|
+
_set("boxplot.flierprops.linestyle", "none")
|
166
|
+
_set("boxplot.flierprops.linewidth", 1.0)
|
167
|
+
_set("boxplot.boxprops.color", "black")
|
168
|
+
_set("boxplot.boxprops.linewidth", 1.0)
|
169
|
+
_set("boxplot.boxprops.linestyle", "-")
|
170
|
+
_set("boxplot.whiskerprops.color", "black")
|
171
|
+
_set("boxplot.whiskerprops.linewidth", 1.0)
|
172
|
+
_set("boxplot.whiskerprops.linestyle", "-")
|
173
|
+
_set("boxplot.capprops.color", "black")
|
174
|
+
_set("boxplot.capprops.linewidth", 1.0)
|
175
|
+
_set("boxplot.capprops.linestyle", "-")
|
176
|
+
_set("boxplot.medianprops.color", "C1")
|
177
|
+
_set("boxplot.medianprops.linewidth", 1.0)
|
178
|
+
_set("boxplot.medianprops.linestyle", "-")
|
179
|
+
_set("boxplot.meanprops.color", "C2")
|
180
|
+
_set("boxplot.meanprops.marker", "^")
|
181
|
+
_set("boxplot.meanprops.markerfacecolor", "C2")
|
182
|
+
_set("boxplot.meanprops.markeredgecolor", "C2")
|
183
|
+
_set("boxplot.meanprops.markersize", 6)
|
184
|
+
_set("boxplot.meanprops.linestyle", "--")
|
185
|
+
_set("boxplot.meanprops.linewidth", 1.0)
|
142
186
|
|
143
187
|
# The font properties used by `text.Text`.
|
144
188
|
# See https://matplotlib.org/stable/api/font_manager_api.html
|
145
189
|
# Note that for font.serif, font.sans-serif, and font.monospace, the first element
|
146
190
|
# of the list (a DejaVu font) will always be used because DejaVu is shipped with
|
147
191
|
# Matplotlib and is thus guaranteed to be available.
|
148
|
-
_set(
|
149
|
-
_set(
|
150
|
-
_set(
|
192
|
+
_set("font.family", "sans-serif")
|
193
|
+
_set("font.style", "normal") # {normal (or roman), italic, oblique}
|
194
|
+
_set("font.variant", "normal") # {normal, small-caps}
|
151
195
|
# The font.weight property has effectively 13 values: normal, bold, bolder, lighter,
|
152
196
|
# 100, 200, 300, ..., 900. Normal is the same as 400, and bold is 700. bolder and
|
153
197
|
# lighter are relative values with respect to the current weight.
|
154
|
-
_set(
|
155
|
-
_set(
|
198
|
+
_set("font.weight", "normal")
|
199
|
+
_set("font.stretch", "normal") # Currently not implemented.
|
156
200
|
# The font.size property is the default font size for text, given in points. 10 pt
|
157
201
|
# is the standard value. Special text sizes can be defined relative to font.size,
|
158
202
|
# using the following values: xx-small, x-small, small, medium, large, x-large,
|
159
203
|
# xx-large, larger, or smaller
|
160
|
-
_set(
|
204
|
+
_set("font.size", 14.0)
|
161
205
|
|
162
206
|
## The text properties used by `text.Text`.
|
163
207
|
## See https://matplotlib.org/stable/api/artist_api.html#module-matplotlib.text
|
164
|
-
_set(
|
208
|
+
_set("text.color", "black")
|
165
209
|
# FreeType hinting flag {default, no_autohint, force_autohint, no_hinting}
|
166
|
-
_set(
|
210
|
+
_set("text.hinting", "force_autohint")
|
167
211
|
# Specifies the amount of softness for hinting in the horizontal direction.
|
168
212
|
# A value of 1 will hint to full pixels. A value of 2 will hint to half pixels etc.
|
169
|
-
_set(
|
213
|
+
_set("text.hinting_factor", 8)
|
170
214
|
# Specifies the scaling factor for kerning values. This is provided solely to
|
171
215
|
# allow old test images to remain unchanged. Set to 6 to obtain previous behavior.
|
172
216
|
# Values other than 0 or 6 have no defined meaning.
|
173
|
-
_set(
|
174
|
-
_set(
|
217
|
+
_set("text.kerning_factor", 0)
|
218
|
+
_set("text.antialiased", True) # This only affects raster outputs.
|
175
219
|
# Use mathtext if there is an even number of unescaped dollar signs.
|
176
|
-
_set(
|
220
|
+
_set("text.parse_math", True)
|
177
221
|
|
178
222
|
# LaTeX
|
179
223
|
# See https://matplotlib.org/stable/users/explain/text/usetex.html
|
180
|
-
_set(
|
224
|
+
_set("text.usetex", False) # use latex for all text handling.
|
181
225
|
# Font set can be {dejavusans, dejavuserif, cm, stixsans, custom}, where
|
182
226
|
# "custom" is defined by the mathtext.bf, .cal, .it, ..., settings which map
|
183
227
|
# a TeX font name to a fontconfig font pattern.
|
184
|
-
_set(
|
185
|
-
_set(
|
186
|
-
_set(
|
228
|
+
_set("mathtext.fontset", "dejavusans")
|
229
|
+
_set("mathtext.fallback", "cm")
|
230
|
+
_set("mathtext.default", "it")
|
187
231
|
|
188
232
|
# Axes
|
189
233
|
# 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(
|
234
|
+
_set("axes.facecolor", "white") # axes background color
|
235
|
+
_set("axes.edgecolor", "black") # axes edge color
|
236
|
+
_set("axes.linewidth", 1.2) # edge line width
|
237
|
+
_set("axes.grid", True) # display grid or not
|
238
|
+
_set("axes.grid.axis", "both") # which axis the grid should apply to
|
239
|
+
_set("axes.grid.which", "major") # grid lines at {major, minor, both} ticks
|
240
|
+
_set("axes.titlelocation", "center") # alignment of the title: {left, right, center}
|
241
|
+
_set("axes.titlesize", "large") # font size of the axes title
|
242
|
+
_set("axes.titleweight", "normal") # font weight of title
|
199
243
|
# 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(
|
244
|
+
_set("axes.titlecolor", "auto")
|
245
|
+
_set("axes.titley", None) # position title (axes relative units). None implies auto
|
246
|
+
_set("axes.titlepad", 6.0) # pad between axes and title in points
|
247
|
+
_set("axes.labelsize", "medium") # font size of the x and y labels
|
248
|
+
_set("axes.labelpad", 4.0) # space between label and axis
|
249
|
+
_set("axes.labelweight", "normal") # weight of the x and y labels
|
250
|
+
_set("axes.labelcolor", "black")
|
207
251
|
# Draw axis gridlines and ticks:
|
208
252
|
# - below patches (True)
|
209
|
-
# - above patches but below lines (
|
253
|
+
# - above patches but below lines ("line")
|
210
254
|
# - above all (False)
|
211
|
-
_set(
|
255
|
+
_set("axes.axisbelow", "line")
|
212
256
|
# Use scientific notation if log10 of the axis range is smaller than the
|
213
257
|
# first or larger than the second
|
214
|
-
_set(
|
215
|
-
_set(
|
258
|
+
_set("axes.formatter.limits", (-5, 6))
|
259
|
+
_set("axes.formatter.use_locale", False)
|
216
260
|
# When True, use mathtext for scientific notation.
|
217
|
-
_set(
|
261
|
+
_set("axes.formatter.use_mathtext", False)
|
218
262
|
# Minimum exponent to format in scientific notation
|
219
|
-
_set(
|
263
|
+
_set("axes.formatter.min_exponent", 0)
|
220
264
|
# If True, the tick label formatter will default to labeling ticks relative
|
221
265
|
# to an offset when the data range is small compared to the minimum absolute
|
222
266
|
# value of the data.
|
223
|
-
_set(
|
267
|
+
_set("axes.formatter.useoffset", True)
|
224
268
|
# When useoffset is True, the offset will be used when it can remove
|
225
269
|
# at least this number of significant digits from tick labels.
|
226
|
-
_set(
|
227
|
-
_set(
|
228
|
-
_set(
|
229
|
-
_set(
|
230
|
-
_set(
|
270
|
+
_set("axes.formatter.offset_threshold", 4)
|
271
|
+
_set("axes.spines.left", True) # display axis spines
|
272
|
+
_set("axes.spines.bottom", True)
|
273
|
+
_set("axes.spines.top", True)
|
274
|
+
_set("axes.spines.right", True)
|
231
275
|
# use Unicode for the minus symbol rather than hyphen. See
|
232
276
|
# https://en.wikipedia.org/wiki/Plus_and_minus_signs#Character_codes
|
233
|
-
_set(
|
234
|
-
_set(
|
235
|
-
_set(
|
236
|
-
_set(
|
237
|
-
_set(
|
277
|
+
_set("axes.unicode_minus", True)
|
278
|
+
_set("axes.prop_cycle", cycler("color", DEFAULT_COLOR_CYCLE))
|
279
|
+
_set("axes.xmargin", .05) # x margin. See `axes.Axes.margins`
|
280
|
+
_set("axes.ymargin", .05) # y margin. See `axes.Axes.margins`
|
281
|
+
_set("axes.zmargin", .05) # z margin. See `axes.Axes.margins`
|
238
282
|
# If "data", use axes.xmargin and axes.ymargin as is.
|
239
283
|
# If "round_numbers", after application of margins, axis limits are further expanded
|
240
284
|
# to the nearest "round" number.
|
241
|
-
_set(
|
242
|
-
_set(
|
243
|
-
_set(
|
285
|
+
_set("axes.autolimit_mode", "data")
|
286
|
+
_set("polaraxes.grid", True) # display grid on polar axes
|
287
|
+
_set("axes3d.grid", True) # display grid on 3D axes
|
244
288
|
# 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(
|
289
|
+
_set("axes3d.automargin", False)
|
290
|
+
_set("axes3d.xaxis.panecolor", (0.95, 0.95, 0.95, 0.5)) # background pane on 3D axes
|
291
|
+
_set("axes3d.yaxis.panecolor", (0.90, 0.90, 0.90, 0.5)) # background pane on 3D axes
|
292
|
+
_set("axes3d.zaxis.panecolor", (0.925, 0.925, 0.925, 0.5)) # background pane on 3D axes
|
293
|
+
_set("axes3d.mouserotationstyle", "arcball") # {azel, trackball, sphere, arcball}
|
294
|
+
_set("axes3d.trackballsize", 0.667) # trackball diameter, in units of the Axes bbox
|
295
|
+
# trackball border width, in units of the Axes bbox (only for "sphere" and "arcball" style)
|
296
|
+
_set("axes3d.trackballborder", 0.2)
|
253
297
|
|
254
298
|
# Axis
|
255
|
-
_set(
|
256
|
-
_set(
|
299
|
+
_set("xaxis.labellocation", "center") # {left, right, center}
|
300
|
+
_set("yaxis.labellocation", "center") # {bottom, top, center}
|
257
301
|
|
258
302
|
# Dates
|
259
303
|
# 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
|
304
|
+
_set("date.autoformatter.year", "%Y")
|
305
|
+
_set("date.autoformatter.month", "%Y-%m")
|
306
|
+
_set("date.autoformatter.day", "%Y-%m-%d")
|
307
|
+
_set("date.autoformatter.hour", "%m-%d %H")
|
308
|
+
_set("date.autoformatter.minute", "%d %H:%M")
|
309
|
+
_set("date.autoformatter.second", "%H:%M:%S")
|
310
|
+
_set("date.autoformatter.microsecond", "%M:%S.%f")
|
311
|
+
# The reference date for Matplotlib"s internal date representation
|
268
312
|
# See https://matplotlib.org/stable/gallery/ticks/date_precision_and_epochs.html
|
269
|
-
_set(
|
270
|
-
_set(
|
313
|
+
_set("date.epoch", "1970-01-01T00:00:00")
|
314
|
+
_set("date.converter", "auto") # {auto, concise}
|
271
315
|
# For auto converter whether to use interval_multiples:
|
272
|
-
_set(
|
316
|
+
_set("date.interval_multiples", True)
|
273
317
|
|
274
318
|
# Ticks
|
275
319
|
# 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(
|
320
|
+
_set("xtick.top", False) # draw ticks on the top side
|
321
|
+
_set("xtick.bottom", True) # draw ticks on the bottom side
|
322
|
+
_set("xtick.labeltop", False) # draw label on the top
|
323
|
+
_set("xtick.labelbottom", True) # draw label on the bottom
|
324
|
+
_set("xtick.major.size", 3.5) # major tick size in points
|
325
|
+
_set("xtick.minor.size", 2) # minor tick size in points
|
326
|
+
_set("xtick.major.width", 0.8) # major tick width in points
|
327
|
+
_set("xtick.minor.width", 0.6) # minor tick width in points
|
328
|
+
_set("xtick.major.pad", 3.5) # distance to major tick label in points
|
329
|
+
_set("xtick.minor.pad", 3.4) # distance to the minor tick label in points
|
330
|
+
_set("xtick.color", "black") # color of the ticks
|
287
331
|
# 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(
|
332
|
+
_set("xtick.labelcolor", "inherit")
|
333
|
+
_set("xtick.labelsize", "medium") # font size of the tick labels
|
334
|
+
_set("xtick.direction", "out") # direction: {in, out, inout}
|
335
|
+
_set("xtick.minor.visible", False) # visibility of minor ticks on x-axis
|
336
|
+
_set("xtick.major.top", True) # draw x axis top major ticks
|
337
|
+
_set("xtick.major.bottom", True) # draw x axis bottom major ticks
|
338
|
+
_set("xtick.minor.top", True) # draw x axis top minor ticks
|
339
|
+
_set("xtick.minor.bottom", True) # draw x axis bottom minor ticks
|
340
|
+
_set("xtick.minor.ndivs", "auto") # number of minor ticks between the major ticks on x-axis
|
341
|
+
_set("xtick.alignment", "center") # alignment of xticks
|
342
|
+
_set("ytick.left", True) # draw ticks on the left side
|
343
|
+
_set("ytick.right", False) # draw ticks on the right side
|
344
|
+
_set("ytick.labelleft", True) # draw tick labels on the left side
|
345
|
+
_set("ytick.labelright", False) # draw tick labels on the right side
|
346
|
+
_set("ytick.major.size", 3.5) # major tick size in points
|
347
|
+
_set("ytick.minor.size", 2) # minor tick size in points
|
348
|
+
_set("ytick.major.width", 0.8) # major tick width in points
|
349
|
+
_set("ytick.minor.width", 0.6) # minor tick width in points
|
350
|
+
_set("ytick.major.pad", 3.5) # distance to major tick label in points
|
351
|
+
_set("ytick.minor.pad", 3.4) # distance to the minor tick label in points
|
352
|
+
_set("ytick.color", "black") # color of the ticks
|
353
|
+
_set("ytick.labelcolor", "inherit") # color of the tick labels or inherit from ytick.color
|
354
|
+
_set("ytick.labelsize", "medium") # font size of the tick labels
|
355
|
+
_set("ytick.direction", "out") # direction: {in, out, inout}
|
356
|
+
_set("ytick.minor.visible", False) # visibility of minor ticks on y-axis
|
357
|
+
_set("ytick.major.left", True) # draw y axis left major ticks
|
358
|
+
_set("ytick.major.right", True) # draw y axis right major ticks
|
359
|
+
_set("ytick.minor.left", True) # draw y axis left minor ticks
|
360
|
+
_set("ytick.minor.right", True) # draw y axis right minor ticks
|
361
|
+
_set("ytick.minor.ndivs", "auto") # number of minor ticks between the major ticks on y-axis
|
362
|
+
_set("ytick.alignment", "center_baseline") # alignment of yticks
|
319
363
|
|
320
364
|
# Grids
|
321
|
-
_set(
|
322
|
-
_set(
|
323
|
-
_set(
|
324
|
-
_set(
|
365
|
+
_set("grid.color", "#c0c0c0") # grid color
|
366
|
+
_set("grid.linestyle", "--") # line style
|
367
|
+
_set("grid.linewidth", 0.8) # in points
|
368
|
+
_set("grid.alpha", 0.8) # transparency, between 0.0 and 1.0
|
325
369
|
|
326
370
|
|
327
371
|
# Legends
|
328
|
-
_set(
|
329
|
-
_set(
|
330
|
-
_set(
|
331
|
-
_set(
|
332
|
-
_set(
|
372
|
+
_set("legend.loc", "best")
|
373
|
+
_set("legend.frameon", True) # if True, draw the legend on a background patch
|
374
|
+
_set("legend.framealpha", 0.75) # legend patch transparency
|
375
|
+
_set("legend.facecolor", "inherit") # inherit from axes.facecolor; or color spec
|
376
|
+
_set("legend.edgecolor", "#a0a0a0") # background patch boundary color
|
333
377
|
# 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(
|
378
|
+
_set("legend.fancybox", True)
|
379
|
+
_set("legend.shadow", False) # if True, give background a shadow effect
|
380
|
+
_set("legend.numpoints", 1) # the number of marker points in the legend line
|
381
|
+
_set("legend.scatterpoints", 1) # number of scatter points
|
382
|
+
_set("legend.markerscale", 1.0) # the relative size of legend markers vs. original
|
383
|
+
_set("legend.fontsize", "small")
|
384
|
+
_set("legend.labelcolor", None)
|
385
|
+
_set("legend.title_fontsize", None) # None sets to the same as the default axes.
|
342
386
|
# Dimensions as fraction of font size:
|
343
|
-
_set(
|
344
|
-
_set(
|
345
|
-
_set(
|
346
|
-
_set(
|
347
|
-
_set(
|
348
|
-
_set(
|
349
|
-
_set(
|
387
|
+
_set("legend.borderpad", 0.4) # border whitespace
|
388
|
+
_set("legend.labelspacing", 0.5) # the vertical space between the legend entries
|
389
|
+
_set("legend.handlelength", 2.0) # the length of the legend lines
|
390
|
+
_set("legend.handleheight", 0.7) # the height of the legend handle
|
391
|
+
_set("legend.handletextpad", 0.8) # the space between the legend line and legend text
|
392
|
+
_set("legend.borderaxespad", 0.5) # the border between the axes and legend edge
|
393
|
+
_set("legend.columnspacing", 2.0) # column separation
|
350
394
|
|
351
395
|
# Figures
|
352
396
|
## 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(
|
397
|
+
_set("figure.titlesize", "large") # size of the figure title
|
398
|
+
_set("figure.titleweight", "normal") # weight of the figure title
|
399
|
+
_set("figure.labelsize", "large") # size of the figure label
|
400
|
+
_set("figure.labelweight", "normal") # weight of the figure label
|
401
|
+
_set("figure.figsize", DEFAULT_FIGURE_SIZE) # figure size in inches
|
402
|
+
_set("figure.dpi", 100) # figure dots per inch
|
403
|
+
_set("figure.facecolor", "white") # figure face color
|
404
|
+
_set("figure.edgecolor", "white") # figure edge color
|
405
|
+
_set("figure.frameon", True) # enable figure frame
|
406
|
+
_set("figure.max_open_warning", 20)
|
407
|
+
_set("figure.raise_window", True) # Raise the GUI window to front when show() is called
|
364
408
|
# The figure subplot parameters.
|
365
409
|
# All dimensions are a fraction of the figure width and height.
|
366
|
-
_set(
|
367
|
-
_set(
|
368
|
-
_set(
|
369
|
-
_set(
|
410
|
+
_set("figure.subplot.left", 0.125) # the left side of the subplots of the figure
|
411
|
+
_set("figure.subplot.right", 0.97) # the right side of the subplots of the figure
|
412
|
+
_set("figure.subplot.bottom", 0.11) # the bottom of the subplots of the figure
|
413
|
+
_set("figure.subplot.top", 0.96) # the top of the subplots of the figure
|
370
414
|
# Amount of width reserved for space between subplots, expressed as a fraction
|
371
415
|
# of the average axis width.
|
372
|
-
_set(
|
416
|
+
_set("figure.subplot.wspace", 0.2)
|
373
417
|
# Amount of height reserved for space between subplots, expressed as a fraction
|
374
418
|
# of the average axis height
|
375
|
-
_set(
|
419
|
+
_set("figure.subplot.hspace", 0.2)
|
376
420
|
# When True, automatically adjust subplot parameters to make the plot fit the figure
|
377
421
|
# using `tight_layout`
|
378
|
-
_set(
|
422
|
+
_set("figure.autolayout", False)
|
379
423
|
# When True, automatically make plot elements fit on the figure.
|
380
424
|
# (Not compatible with `autolayout`, above).
|
381
|
-
_set(
|
425
|
+
_set("figure.constrained_layout.use", False)
|
382
426
|
# Padding (in inches) around axes; defaults to 3/72 inches, i.e. 3 points.
|
383
|
-
_set(
|
384
|
-
_set(
|
427
|
+
_set("figure.constrained_layout.h_pad", 0.04167)
|
428
|
+
_set("figure.constrained_layout.w_pad", 0.04167)
|
385
429
|
# Spacing between subplots, relative to the subplot sizes. Much smaller than for
|
386
430
|
# tight_layout (figure.subplot.hspace, figure.subplot.wspace) as constrained_layout
|
387
431
|
# already takes surrounding texts (titles, labels, # ticklabels) into account.
|
388
|
-
_set(
|
389
|
-
_set(
|
432
|
+
_set("figure.constrained_layout.hspace", 0.02)
|
433
|
+
_set("figure.constrained_layout.wspace", 0.02)
|
390
434
|
|
391
435
|
# Images
|
392
|
-
_set(
|
393
|
-
_set(
|
394
|
-
_set(
|
395
|
-
_set(
|
396
|
-
_set(
|
397
|
-
_set(
|
398
|
-
_set(
|
436
|
+
_set("image.aspect", "equal") # {equal, auto} or a number
|
437
|
+
_set("image.interpolation", "auto") # see help(imshow) for options
|
438
|
+
_set("image.interpolation_stage", "auto") # see help(imshow) for options
|
439
|
+
_set("image.cmap", "viridis") # A colormap name (plasma, magma, etc.)
|
440
|
+
_set("image.lut", 256) # the size of the colormap lookup table
|
441
|
+
_set("image.origin", "upper") # {lower, upper}
|
442
|
+
_set("image.resample", True)
|
399
443
|
# When True, all the images on a set of axes are combined into a single composite
|
400
444
|
# image before saving a figure as a vector graphics file, such as a PDF.
|
401
|
-
_set(
|
445
|
+
_set("image.composite_image", True)
|
402
446
|
|
403
447
|
# Various plots.
|
404
|
-
_set(
|
405
|
-
_set(
|
406
|
-
_set(
|
407
|
-
_set(
|
408
|
-
_set(
|
409
|
-
_set(
|
410
|
-
_set(
|
411
|
-
_set(
|
448
|
+
_set("contour.negative_linestyle", "dashed") # string or on-off ink sequence
|
449
|
+
_set("contour.corner_mask", True) # {True, False}
|
450
|
+
_set("contour.linewidth", None)
|
451
|
+
_set("contour.algorithm", "mpl2014") # {mpl2005, mpl2014, serial, threaded}
|
452
|
+
_set("errorbar.capsize", 0) # length of end cap on error bars in pixels
|
453
|
+
_set("hist.bins", 10) # The default number of histogram bins or "auto".
|
454
|
+
_set("scatter.marker", "o") # The default marker type for scatter plots.
|
455
|
+
_set("scatter.edgecolors", "face") # The default edge colors for scatter plots.
|
412
456
|
|
413
457
|
# Paths
|
414
458
|
# When True, simplify paths by removing "invisible" points to reduce file size
|
415
459
|
# and increase rendering speed
|
416
|
-
_set(
|
460
|
+
_set("path.simplify", True)
|
417
461
|
# The threshold of similarity below which vertices will be removed in
|
418
462
|
# the simplification process.
|
419
|
-
_set(
|
463
|
+
_set("path.simplify_threshold", 0.111111111111)
|
420
464
|
# When True, rectilinear axis-aligned paths will be snapped to the nearest pixel
|
421
465
|
# when certain criteria are met. When False, paths will never be snapped.
|
422
|
-
_set(
|
466
|
+
_set("path.snap", True)
|
423
467
|
# May be None, or a tuple of the form: path.sketch: (scale, length, randomness)
|
424
468
|
# - scale is the amplitude of the wiggle perpendicular to the line (in pixels).
|
425
469
|
# - length is the length of the wiggle along the line (in pixels).
|
426
470
|
# - randomness is the factor by which the length is randomly scaled.
|
427
|
-
_set(
|
471
|
+
_set("path.sketch", None)
|
428
472
|
|
429
473
|
# Saving figures...
|
430
474
|
# The default savefig parameters can be different from the display parameters
|
431
|
-
_set(
|
432
|
-
_set(
|
433
|
-
_set(
|
434
|
-
_set(
|
435
|
-
_set(
|
436
|
-
_set(
|
475
|
+
_set("savefig.dpi", 300) # figure dots per inch or "figure"
|
476
|
+
_set("savefig.facecolor", "auto") # figure face color when saving
|
477
|
+
_set("savefig.edgecolor", "auto") # figure edge color when saving
|
478
|
+
_set("savefig.format", "png") # {png, ps, pdf, svg}
|
479
|
+
_set("savefig.bbox", "standard") # {tight, standard}
|
480
|
+
_set("savefig.pad_inches", 0.1) # padding to be used, when bbox is set to "tight"
|
437
481
|
# Default directory in savefig dialog, gets updated after interactive saves,
|
438
|
-
# unless set to the empty string (i.e. the current directory); use
|
482
|
+
# unless set to the empty string (i.e. the current directory); use "." to start
|
439
483
|
# at the current directory but update after interactive saves
|
440
|
-
_set(
|
484
|
+
_set("savefig.directory", "")
|
441
485
|
# Whether figures are saved with a transparent background by default
|
442
|
-
_set(
|
486
|
+
_set("savefig.transparent", False)
|
443
487
|
# Orientation of saved figure, for PostScript output only
|
444
|
-
_set(
|
445
|
-
_set(
|
446
|
-
_set(
|
488
|
+
_set("savefig.orientation", "portrait")
|
489
|
+
_set("macosx.window_mode", "system")
|
490
|
+
_set("tk.window_focus", False) # Maintain shell focus for TkAgg
|
447
491
|
# Integer from 0 to 9, 0 disables compression (good for debugging)
|
448
|
-
_set(
|
449
|
-
_set(
|
450
|
-
_set(
|
451
|
-
_set(
|
452
|
-
_set(
|
492
|
+
_set("pdf.compression", 6)
|
493
|
+
_set("pdf.fonttype", 3) # Output Type 3 (Type3) or Type 42 (TrueType)
|
494
|
+
_set("pdf.use14corefonts", False)
|
495
|
+
_set("pdf.inheritcolor", False)
|
496
|
+
_set("svg.image_inline", True) # Write raster image data directly into the SVG file
|
453
497
|
# How to handle SVG fonts:
|
454
498
|
# - path: embed characters as paths -- supported by most SVG renderers
|
455
499
|
# - None: assume fonts are installed on the machine where the SVG will be viewed.
|
456
|
-
_set(
|
457
|
-
_set(
|
500
|
+
_set("svg.fonttype", "path")
|
501
|
+
_set("svg.hashsalt", None) # If not None, use this string as hash salt instead of uuid4
|
458
502
|
# If not None, use this string as the value for the `id` attribute in the top <svg> tag
|
459
|
-
_set(
|
503
|
+
_set("svg.id", None)
|
460
504
|
# See https://matplotlib.org/stable/tutorials/text/pgf.html for more information.
|
461
|
-
_set(
|
462
|
-
_set(
|
463
|
-
_set(
|
505
|
+
_set("pgf.rcfonts", True)
|
506
|
+
_set("pgf.texsystem", "xelatex")
|
507
|
+
_set("docstring.hardcopy", False) # set this when you want to generate hardcopy docstring
|
464
508
|
|
465
509
|
# Animations
|
466
510
|
# How to display the animation as HTML in the IPython notebook:
|
467
|
-
# -
|
468
|
-
# -
|
469
|
-
_set(
|
470
|
-
_set(
|
471
|
-
_set(
|
511
|
+
# - "html5" uses HTML5 video tag
|
512
|
+
# - "jshtml" creates a JavaScript animation
|
513
|
+
_set("animation.html", "none")
|
514
|
+
_set("animation.writer", "ffmpeg") # MovieWriter "backend" to use
|
515
|
+
_set("animation.codec", "h264") # Codec to use for writing movie
|
472
516
|
# Controls size/quality trade-off for movie.
|
473
517
|
# -1 implies let utility auto-determine
|
474
|
-
_set(
|
475
|
-
_set(
|
518
|
+
_set("animation.bitrate", -1)
|
519
|
+
_set("animation.frame_format", "png") # Controls frame format used by temp files
|
476
520
|
# Path to ffmpeg binary. Unqualified paths are resolved by subprocess.Popen.
|
477
|
-
_set(
|
478
|
-
# Path to ImageMagick
|
521
|
+
_set("animation.ffmpeg_path", "ffmpeg")
|
522
|
+
# Path to ImageMagick"s convert binary. Unqualified paths are resolved by
|
479
523
|
# subprocess.Popen, except that on Windows, we look up an install of
|
480
524
|
# ImageMagick in the registry (as convert is also the name of a system tool).
|
481
|
-
_set(
|
525
|
+
_set("animation.convert_path", "convert")
|
482
526
|
# Limit, in MB, of size of base64 encoded animation in HTML (i.e. IPython notebook)
|
483
|
-
_set(
|
527
|
+
_set("animation.embed_limit", 20.0)
|
484
528
|
|
485
529
|
|
486
530
|
configure()
|