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/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
- '#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b',
31
- '#e377c2', '#7f7f7f', '#bcbd22', '#17becf'
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'Unknown matplotlib rc param {key}, skipping...')
82
+ logger.warning(f"Unknown matplotlib rc param {key}, skipping...")
46
83
  except ValueError as exception:
47
- logger.warning(f'{exception}, skipping...')
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('interactive', False)
58
- _set('timezone', 'UTC')
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('lines.linewidth', 1.5) # line width in points
63
- _set('lines.linestyle', '-') # solid line
64
- _set('lines.color', 'C0') # has no affect on plot(); see axes.prop_cycle
65
- _set('lines.marker', 'None') # the default marker
66
- _set('lines.markerfacecolor', 'auto') # the default marker face color
67
- _set('lines.markeredgecolor', 'auto') # the default marker edge color
68
- _set('lines.markeredgewidth', 1.0) # the line width around the marker symbol
69
- _set('lines.markersize', 6) # marker size, in points
70
- _set('lines.dash_joinstyle', 'round') # {miter, round, bevel}
71
- _set('lines.dash_capstyle', 'butt') # {butt, round, projecting}
72
- _set('lines.solid_joinstyle', 'round') # {miter, round, bevel}
73
- _set('lines.solid_capstyle', 'projecting') # {butt, round, projecting}
74
- _set('lines.antialiased', True) # render lines in antialiased (no jaggies)
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('lines.dashed_pattern', (3.7, 1.6))
77
- _set('lines.dashdot_pattern', (6.4, 1.6, 1, 1.6))
78
- _set('lines.dotted_pattern', (1, 1.65))
79
- _set('lines.scale_dashes', True)
80
- _set('markers.fillstyle', 'full') # {full, left, right, bottom, top, none}
81
- _set('pcolor.shading', 'auto')
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('pcolormesh.snap', True)
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('patch.linewidth', 1.0) # edge width in points.
89
- _set('patch.facecolor', 'C0')
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('patch.edgecolor', 'black')
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('patch.force_edgecolor', False)
98
- _set('patch.antialiased', True) # render patches in antialiased (no jaggies)
141
+ _set("patch.force_edgecolor", True)
142
+ _set("patch.antialiased", True) # render patches in antialiased (no jaggies)
99
143
 
100
144
  # Hatches
101
- _set('hatch.color', 'black')
102
- _set('hatch.linewidth', 1.0)
103
-
104
- # Boxplot---we don't really use these much, but you never know...
105
- _set('boxplot.notch', False)
106
- _set('boxplot.vertical', True)
107
- _set('boxplot.whiskers', 1.5)
108
- _set('boxplot.bootstrap', None)
109
- _set('boxplot.patchartist', False)
110
- _set('boxplot.showmeans', False)
111
- _set('boxplot.showcaps', True)
112
- _set('boxplot.showbox', True)
113
- _set('boxplot.showfliers', True)
114
- _set('boxplot.meanline', False)
115
- _set('boxplot.flierprops.color', 'black')
116
- _set('boxplot.flierprops.marker', 'o')
117
- _set('boxplot.flierprops.markerfacecolor', 'none')
118
- _set('boxplot.flierprops.markeredgecolor', 'black')
119
- _set('boxplot.flierprops.markeredgewidth', 1.0)
120
- _set('boxplot.flierprops.markersize', 6)
121
- _set('boxplot.flierprops.linestyle', 'none')
122
- _set('boxplot.flierprops.linewidth', 1.0)
123
- _set('boxplot.boxprops.color', 'black')
124
- _set('boxplot.boxprops.linewidth', 1.0)
125
- _set('boxplot.boxprops.linestyle', '-')
126
- _set('boxplot.whiskerprops.color', 'black')
127
- _set('boxplot.whiskerprops.linewidth', 1.0)
128
- _set('boxplot.whiskerprops.linestyle', '-')
129
- _set('boxplot.capprops.color', 'black')
130
- _set('boxplot.capprops.linewidth', 1.0)
131
- _set('boxplot.capprops.linestyle', '-')
132
- _set('boxplot.medianprops.color', 'C1')
133
- _set('boxplot.medianprops.linewidth', 1.0)
134
- _set('boxplot.medianprops.linestyle', '-')
135
- _set('boxplot.meanprops.color', 'C2')
136
- _set('boxplot.meanprops.marker', '^')
137
- _set('boxplot.meanprops.markerfacecolor', 'C2')
138
- _set('boxplot.meanprops.markeredgecolor', 'C2')
139
- _set('boxplot.meanprops.markersize', 6)
140
- _set('boxplot.meanprops.linestyle', '--')
141
- _set('boxplot.meanprops.linewidth', 1.0)
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('font.family', 'sans-serif')
149
- _set('font.style', 'normal') # {normal (or roman), italic, oblique}
150
- _set('font.variant', 'normal') # {normal, small-caps}
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('font.weight', 'normal')
155
- _set('font.stretch', 'normal') # Currently not implemented.
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('font.size', 14.0)
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('text.color', 'black')
208
+ _set("text.color", "black")
165
209
  # FreeType hinting flag {default, no_autohint, force_autohint, no_hinting}
166
- _set('text.hinting', 'force_autohint')
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('text.hinting_factor', 8)
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('text.kerning_factor', 0)
174
- _set('text.antialiased', True) # This only affects raster outputs.
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('text.parse_math', True)
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('text.usetex', False) # use latex for all text handling.
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('mathtext.fontset', 'dejavusans')
185
- _set('mathtext.fallback', 'cm')
186
- _set('mathtext.default', 'it')
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('axes.facecolor', 'white') # axes background color
191
- _set('axes.edgecolor', 'black') # axes edge color
192
- _set('axes.linewidth', 1.2) # edge line width
193
- _set('axes.grid', True) # display grid or not
194
- _set('axes.grid.axis', 'both') # which axis the grid should apply to
195
- _set('axes.grid.which', 'major') # grid lines at {major, minor, both} ticks
196
- _set('axes.titlelocation', 'center') # alignment of the title: {left, right, center}
197
- _set('axes.titlesize', 'large') # font size of the axes title
198
- _set('axes.titleweight', 'normal') # font weight of title
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('axes.titlecolor', 'auto')
201
- _set('axes.titley', None) # position title (axes relative units). None implies auto
202
- _set('axes.titlepad', 6.0) # pad between axes and title in points
203
- _set('axes.labelsize', 'medium') # font size of the x and y labels
204
- _set('axes.labelpad', 4.0) # space between label and axis
205
- _set('axes.labelweight', 'normal') # weight of the x and y labels
206
- _set('axes.labelcolor', 'black')
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 ('line')
253
+ # - above patches but below lines ("line")
210
254
  # - above all (False)
211
- _set('axes.axisbelow', 'line')
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('axes.formatter.limits', (-5, 6))
215
- _set('axes.formatter.use_locale', False)
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('axes.formatter.use_mathtext', False)
261
+ _set("axes.formatter.use_mathtext", False)
218
262
  # Minimum exponent to format in scientific notation
219
- _set('axes.formatter.min_exponent', 0)
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('axes.formatter.useoffset', True)
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('axes.formatter.offset_threshold', 4)
227
- _set('axes.spines.left', True) # display axis spines
228
- _set('axes.spines.bottom', True)
229
- _set('axes.spines.top', True)
230
- _set('axes.spines.right', True)
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('axes.unicode_minus', True)
234
- _set('axes.prop_cycle', cycler('color', DEFAULT_COLOR_CYCLE))
235
- _set('axes.xmargin', .05) # x margin. See `axes.Axes.margins`
236
- _set('axes.ymargin', .05) # y margin. See `axes.Axes.margins`
237
- _set('axes.zmargin', .05) # z margin. See `axes.Axes.margins`
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('axes.autolimit_mode', 'data')
242
- _set('polaraxes.grid', True) # display grid on polar axes
243
- _set('axes3d.grid', True) # display grid on 3D axes
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('axes3d.automargin', False)
246
- _set('axes3d.xaxis.panecolor', (0.95, 0.95, 0.95, 0.5)) # background pane on 3D axes
247
- _set('axes3d.yaxis.panecolor', (0.90, 0.90, 0.90, 0.5)) # background pane on 3D axes
248
- _set('axes3d.zaxis.panecolor', (0.925, 0.925, 0.925, 0.5)) # background pane on 3D axes
249
- _set('axes3d.mouserotationstyle', 'arcball') # {azel, trackball, sphere, arcball}
250
- _set('axes3d.trackballsize', 0.667) # trackball diameter, in units of the Axes bbox
251
- # trackball border width, in units of the Axes bbox (only for 'sphere' and 'arcball' style)
252
- _set('axes3d.trackballborder', 0.2)
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('xaxis.labellocation', 'center') # {left, right, center}
256
- _set('yaxis.labellocation', 'center') # {bottom, top, center}
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('date.autoformatter.year', '%Y')
261
- _set('date.autoformatter.month', '%Y-%m')
262
- _set('date.autoformatter.day', '%Y-%m-%d')
263
- _set('date.autoformatter.hour', '%m-%d %H')
264
- _set('date.autoformatter.minute', '%d %H:%M')
265
- _set('date.autoformatter.second', '%H:%M:%S')
266
- _set('date.autoformatter.microsecond', '%M:%S.%f')
267
- # The reference date for Matplotlib's internal date representation
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('date.epoch', '1970-01-01T00:00:00')
270
- _set('date.converter', 'auto') # {auto, concise}
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('date.interval_multiples', True)
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('xtick.top', False) # draw ticks on the top side
277
- _set('xtick.bottom', True) # draw ticks on the bottom side
278
- _set('xtick.labeltop', False) # draw label on the top
279
- _set('xtick.labelbottom', True) # draw label on the bottom
280
- _set('xtick.major.size', 3.5) # major tick size in points
281
- _set('xtick.minor.size', 2) # minor tick size in points
282
- _set('xtick.major.width', 0.8) # major tick width in points
283
- _set('xtick.minor.width', 0.6) # minor tick width in points
284
- _set('xtick.major.pad', 3.5) # distance to major tick label in points
285
- _set('xtick.minor.pad', 3.4) # distance to the minor tick label in points
286
- _set('xtick.color', 'black') # color of the ticks
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('xtick.labelcolor', 'inherit')
289
- _set('xtick.labelsize', 'medium') # font size of the tick labels
290
- _set('xtick.direction', 'out') # direction: {in, out, inout}
291
- _set('xtick.minor.visible', False) # visibility of minor ticks on x-axis
292
- _set('xtick.major.top', True) # draw x axis top major ticks
293
- _set('xtick.major.bottom', True) # draw x axis bottom major ticks
294
- _set('xtick.minor.top', True) # draw x axis top minor ticks
295
- _set('xtick.minor.bottom', True) # draw x axis bottom minor ticks
296
- _set('xtick.minor.ndivs', 'auto') # number of minor ticks between the major ticks on x-axis
297
- _set('xtick.alignment', 'center') # alignment of xticks
298
- _set('ytick.left', True) # draw ticks on the left side
299
- _set('ytick.right', False) # draw ticks on the right side
300
- _set('ytick.labelleft', True) # draw tick labels on the left side
301
- _set('ytick.labelright', False) # draw tick labels on the right side
302
- _set('ytick.major.size', 3.5) # major tick size in points
303
- _set('ytick.minor.size', 2) # minor tick size in points
304
- _set('ytick.major.width', 0.8) # major tick width in points
305
- _set('ytick.minor.width', 0.6) # minor tick width in points
306
- _set('ytick.major.pad', 3.5) # distance to major tick label in points
307
- _set('ytick.minor.pad', 3.4) # distance to the minor tick label in points
308
- _set('ytick.color', 'black') # color of the ticks
309
- _set('ytick.labelcolor', 'inherit') # color of the tick labels or inherit from ytick.color
310
- _set('ytick.labelsize', 'medium') # font size of the tick labels
311
- _set('ytick.direction', 'out') # direction: {in, out, inout}
312
- _set('ytick.minor.visible', False) # visibility of minor ticks on y-axis
313
- _set('ytick.major.left', True) # draw y axis left major ticks
314
- _set('ytick.major.right', True) # draw y axis right major ticks
315
- _set('ytick.minor.left', True) # draw y axis left minor ticks
316
- _set('ytick.minor.right', True) # draw y axis right minor ticks
317
- _set('ytick.minor.ndivs', 'auto') # number of minor ticks between the major ticks on y-axis
318
- _set('ytick.alignment', 'center_baseline') # alignment of yticks
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('grid.color', '#c0c0c0') # grid color
322
- _set('grid.linestyle', '--') # line style
323
- _set('grid.linewidth', 0.8) # in points
324
- _set('grid.alpha', 0.8) # transparency, between 0.0 and 1.0
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('legend.loc', 'best')
329
- _set('legend.frameon', True) # if True, draw the legend on a background patch
330
- _set('legend.framealpha', 0.75) # legend patch transparency
331
- _set('legend.facecolor', 'inherit') # inherit from axes.facecolor; or color spec
332
- _set('legend.edgecolor', '#a0a0a0') # background patch boundary color
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('legend.fancybox', True)
335
- _set('legend.shadow', False) # if True, give background a shadow effect
336
- _set('legend.numpoints', 1) # the number of marker points in the legend line
337
- _set('legend.scatterpoints', 1) # number of scatter points
338
- _set('legend.markerscale', 1.0) # the relative size of legend markers vs. original
339
- _set('legend.fontsize', 'small')
340
- _set('legend.labelcolor', None)
341
- _set('legend.title_fontsize', None) # None sets to the same as the default axes.
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('legend.borderpad', 0.4) # border whitespace
344
- _set('legend.labelspacing', 0.5) # the vertical space between the legend entries
345
- _set('legend.handlelength', 2.0) # the length of the legend lines
346
- _set('legend.handleheight', 0.7) # the height of the legend handle
347
- _set('legend.handletextpad', 0.8) # the space between the legend line and legend text
348
- _set('legend.borderaxespad', 0.5) # the border between the axes and legend edge
349
- _set('legend.columnspacing', 2.0) # column separation
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('figure.titlesize', 'large') # size of the figure title
354
- _set('figure.titleweight', 'normal') # weight of the figure title
355
- _set('figure.labelsize', 'large') # size of the figure label
356
- _set('figure.labelweight', 'normal') # weight of the figure label
357
- _set('figure.figsize', DEFAULT_FIGURE_SIZE) # figure size in inches
358
- _set('figure.dpi', 100) # figure dots per inch
359
- _set('figure.facecolor', 'white') # figure face color
360
- _set('figure.edgecolor', 'white') # figure edge color
361
- _set('figure.frameon', True) # enable figure frame
362
- _set('figure.max_open_warning', 20)
363
- _set('figure.raise_window', True) # Raise the GUI window to front when show() is called
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('figure.subplot.left', 0.125) # the left side of the subplots of the figure
367
- _set('figure.subplot.right', 0.97) # the right side of the subplots of the figure
368
- _set('figure.subplot.bottom', 0.11) # the bottom of the subplots of the figure
369
- _set('figure.subplot.top', 0.96) # the top of the subplots of the figure
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('figure.subplot.wspace', 0.2)
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('figure.subplot.hspace', 0.2)
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('figure.autolayout', False)
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('figure.constrained_layout.use', False)
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('figure.constrained_layout.h_pad', 0.04167)
384
- _set('figure.constrained_layout.w_pad', 0.04167)
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('figure.constrained_layout.hspace', 0.02)
389
- _set('figure.constrained_layout.wspace', 0.02)
432
+ _set("figure.constrained_layout.hspace", 0.02)
433
+ _set("figure.constrained_layout.wspace", 0.02)
390
434
 
391
435
  # Images
392
- _set('image.aspect', 'equal') # {equal, auto} or a number
393
- _set('image.interpolation', 'auto') # see help(imshow) for options
394
- _set('image.interpolation_stage', 'auto') # see help(imshow) for options
395
- _set('image.cmap', 'viridis') # A colormap name (plasma, magma, etc.)
396
- _set('image.lut', 256) # the size of the colormap lookup table
397
- _set('image.origin', 'upper') # {lower, upper}
398
- _set('image.resample', True)
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('image.composite_image', True)
445
+ _set("image.composite_image", True)
402
446
 
403
447
  # Various plots.
404
- _set('contour.negative_linestyle', 'dashed') # string or on-off ink sequence
405
- _set('contour.corner_mask', True) # {True, False}
406
- _set('contour.linewidth', None)
407
- _set('contour.algorithm', 'mpl2014') # {mpl2005, mpl2014, serial, threaded}
408
- _set('errorbar.capsize', 0) # length of end cap on error bars in pixels
409
- _set('hist.bins', 10) # The default number of histogram bins or 'auto'.
410
- _set('scatter.marker', 'o') # The default marker type for scatter plots.
411
- _set('scatter.edgecolors', 'face') # The default edge colors for scatter plots.
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('path.simplify', True)
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('path.simplify_threshold', 0.111111111111)
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('path.snap', True)
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('path.sketch', None)
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('savefig.dpi', 300) # figure dots per inch or 'figure'
432
- _set('savefig.facecolor', 'auto') # figure face color when saving
433
- _set('savefig.edgecolor', 'auto') # figure edge color when saving
434
- _set('savefig.format', 'png') # {png, ps, pdf, svg}
435
- _set('savefig.bbox', 'standard') # {tight, standard}
436
- _set('savefig.pad_inches', 0.1) # padding to be used, when bbox is set to 'tight'
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 '.' to start
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('savefig.directory', '')
484
+ _set("savefig.directory", "")
441
485
  # Whether figures are saved with a transparent background by default
442
- _set('savefig.transparent', False)
486
+ _set("savefig.transparent", False)
443
487
  # Orientation of saved figure, for PostScript output only
444
- _set('savefig.orientation', 'portrait')
445
- _set('macosx.window_mode', 'system')
446
- _set('tk.window_focus', False) # Maintain shell focus for TkAgg
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('pdf.compression', 6)
449
- _set('pdf.fonttype', 3) # Output Type 3 (Type3) or Type 42 (TrueType)
450
- _set('pdf.use14corefonts', False)
451
- _set('pdf.inheritcolor', False)
452
- _set('svg.image_inline', True) # Write raster image data directly into the SVG file
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('svg.fonttype', 'path')
457
- _set('svg.hashsalt', None) # If not None, use this string as hash salt instead of uuid4
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('svg.id', None)
503
+ _set("svg.id", None)
460
504
  # See https://matplotlib.org/stable/tutorials/text/pgf.html for more information.
461
- _set('pgf.rcfonts', True)
462
- _set('pgf.texsystem', 'xelatex')
463
- _set('docstring.hardcopy', False) # set this when you want to generate hardcopy docstring
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
- # - 'html5' uses HTML5 video tag
468
- # - 'jshtml' creates a JavaScript animation
469
- _set('animation.html', 'none')
470
- _set('animation.writer', 'ffmpeg') # MovieWriter 'backend' to use
471
- _set('animation.codec', 'h264') # Codec to use for writing movie
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('animation.bitrate', -1)
475
- _set('animation.frame_format', 'png') # Controls frame format used by temp files
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('animation.ffmpeg_path', 'ffmpeg')
478
- # Path to ImageMagick's convert binary. Unqualified paths are resolved by
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('animation.convert_path', 'convert')
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('animation.embed_limit', 20.0)
527
+ _set("animation.embed_limit", 20.0)
484
528
 
485
529
 
486
530
  configure()