plot-io 0.1.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.
- plot_io/__init__.py +66 -0
- plot_io/_backend.py +114 -0
- plot_io/axis.py +574 -0
- plot_io/colorbar.py +342 -0
- plot_io/decorations.py +496 -0
- plot_io/defaults.py +766 -0
- plot_io/density.py +97 -0
- plot_io/enums.py +63 -0
- plot_io/facets.py +184 -0
- plot_io/figure.py +331 -0
- plot_io/labels.py +63 -0
- plot_io/legend.py +498 -0
- plot_io/limits.py +92 -0
- plot_io/maps/__init__.py +365 -0
- plot_io/maps/data.py +333 -0
- plot_io/markers.py +117 -0
- plot_io/numbers.py +289 -0
- plot_io/occupancy.py +219 -0
- plot_io/palettes.py +142 -0
- plot_io/plot.py +435 -0
- plot_io/render.py +1122 -0
- plot_io/scales.py +93 -0
- plot_io/series/__init__.py +498 -0
- plot_io/series/area.py +181 -0
- plot_io/series/bar.py +294 -0
- plot_io/series/box.py +401 -0
- plot_io/series/catdata.py +23 -0
- plot_io/series/catpoints.py +182 -0
- plot_io/series/contour.py +294 -0
- plot_io/series/curves.py +128 -0
- plot_io/series/ecdf.py +143 -0
- plot_io/series/errorbar.py +111 -0
- plot_io/series/errors.py +100 -0
- plot_io/series/fill.py +168 -0
- plot_io/series/heatmap.py +304 -0
- plot_io/series/hexbin.py +216 -0
- plot_io/series/hist.py +379 -0
- plot_io/series/hist2d.py +163 -0
- plot_io/series/kde.py +228 -0
- plot_io/series/kde2d.py +153 -0
- plot_io/series/line.py +173 -0
- plot_io/series/pie.py +304 -0
- plot_io/series/points.py +341 -0
- plot_io/series/regression.py +250 -0
- plot_io/series/scatter.py +103 -0
- plot_io/series/stem.py +112 -0
- plot_io/series/violin.py +321 -0
- plot_io/settings.py +281 -0
- plot_io/shapes.py +57 -0
- plot_io/sharing.py +160 -0
- plot_io/slots.py +52 -0
- plot_io/stacking.py +63 -0
- plot_io/stats.py +140 -0
- plot_io/style.py +71 -0
- plot_io/styles/__init__.py +234 -0
- plot_io/styles/library.py +732 -0
- plot_io/tables.py +141 -0
- plot_io/text.py +109 -0
- plot_io/ticks.py +284 -0
- plot_io/times.py +199 -0
- plot_io/values.py +161 -0
- plot_io-0.1.0.dist-info/METADATA +102 -0
- plot_io-0.1.0.dist-info/RECORD +65 -0
- plot_io-0.1.0.dist-info/WHEEL +4 -0
- plot_io-0.1.0.dist-info/licenses/LICENSE +28 -0
plot_io/defaults.py
ADDED
|
@@ -0,0 +1,766 @@
|
|
|
1
|
+
"""Every default setting of plot_io, in one place: the default look.
|
|
2
|
+
|
|
3
|
+
``DEFAULTS`` maps setting names to their default values:
|
|
4
|
+
|
|
5
|
+
* bare names are inherited settings (fonts, colors, line width, number formats, palette,
|
|
6
|
+
…): a figure passes them to its plots, a plot to its series, unless set lower down;
|
|
7
|
+
* ``"Class.name"`` is the default of one setting of one class. A class without an entry
|
|
8
|
+
of its own uses its base class's (``Fill.alpha`` overrides ``Series.alpha``).
|
|
9
|
+
|
|
10
|
+
Values are used as given, except functions, which are called with the object and give a
|
|
11
|
+
default that depends on it (a title's size follows the plot's font size). Styles are
|
|
12
|
+
merged over the inherited settings. ``None`` means unset (no value, inherit, or off);
|
|
13
|
+
``"auto"`` means chosen when drawing by the rule that the setting's other defaults
|
|
14
|
+
parametrize (``Axis.padding`` and ``Axis.auto_padding``, ``Axis.max_ticks`` and
|
|
15
|
+
``Axis.tick_spacing``).
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from typing import Any
|
|
19
|
+
|
|
20
|
+
__all__ = ["DEFAULTS", "OKABE_ITO", "inherited", "class_default", "default_of"]
|
|
21
|
+
|
|
22
|
+
#: Okabe–Ito's eight colorblind-safe colors, extended with indigo and dark brown. The
|
|
23
|
+
#: two were chosen as the pair farthest (in Oklab) from every other color under normal
|
|
24
|
+
#: vision and simulated protan, deutan and tritan vision; they stay farther apart than
|
|
25
|
+
#: the closest Okabe–Ito pair.
|
|
26
|
+
OKABE_ITO = ("#0072B2", "#E69F00", "#009E73", "#D55E00", "#CC79A7", "#56B4E9", "#F0E442",
|
|
27
|
+
"#000000", "#332288", "#661100")
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# -- defaults that depend on the object ----------------------------------------------------
|
|
31
|
+
|
|
32
|
+
def figure_plot_width(f: Any) -> float:
|
|
33
|
+
"""3 in, in the figure's unit."""
|
|
34
|
+
return 216.0 / f.points_per_unit
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def figure_plot_height(f: Any) -> float:
|
|
38
|
+
"""2.25 in, in the figure's unit."""
|
|
39
|
+
return 162.0 / f.points_per_unit
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def figure_spacing(f: Any) -> float:
|
|
43
|
+
"""10 pt, in the figure's unit."""
|
|
44
|
+
return 10.0 / f.points_per_unit
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def figure_margin(f: Any) -> float:
|
|
48
|
+
"""4 pt, in the figure's unit."""
|
|
49
|
+
return 4.0 / f.points_per_unit
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def figure_title_size(t: Any) -> float:
|
|
53
|
+
"""1.4 × the figure's font size."""
|
|
54
|
+
return 1.4 * t._figure.get("font_size")
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def figure_title_pad(t: Any) -> float:
|
|
58
|
+
"""0.5 × the title's font size."""
|
|
59
|
+
return 0.5 * t.get("font_size")
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def figure_title_color(t: Any) -> Any:
|
|
63
|
+
"""The figure's text color."""
|
|
64
|
+
return t._figure.get("text_color")
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def title_size(t: Any) -> float:
|
|
68
|
+
"""1.2 × the plot's font size."""
|
|
69
|
+
return 1.2 * t._plot.get("font_size")
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def title_color(t: Any) -> Any:
|
|
73
|
+
"""The plot's text color."""
|
|
74
|
+
return t._plot.get("text_color")
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def legend_title(g: Any) -> Any:
|
|
78
|
+
"""The `group` column name, when there is one."""
|
|
79
|
+
return getattr(g._plot, "_legend_title", None)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def legend_font_size(g: Any) -> float:
|
|
83
|
+
"""The plot's font size."""
|
|
84
|
+
return g._plot.get("font_size")
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def legend_color(g: Any) -> Any:
|
|
88
|
+
"""The plot's text color."""
|
|
89
|
+
return g._plot.get("text_color")
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def axis_font_size(a: Any) -> float:
|
|
93
|
+
"""The axis font size."""
|
|
94
|
+
return a.get("font_size")
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def axis_minor_tick_length(a: Any) -> float:
|
|
98
|
+
"""0.6 × `tick_length`."""
|
|
99
|
+
return 0.6 * a.get("tick_length")
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def axis_color(a: Any) -> Any:
|
|
103
|
+
"""The text color."""
|
|
104
|
+
return a.get("text_color")
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def axis_part_color(a: Any) -> Any:
|
|
108
|
+
"""The axis `color`."""
|
|
109
|
+
return a.get("color")
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def axis_side(a: Any) -> str:
|
|
113
|
+
"""`bottom` for x, `left` for y."""
|
|
114
|
+
return "bottom" if a.role == "x" else "left"
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def axis_zero_line_color(a: Any) -> Any:
|
|
118
|
+
"""The axis `line_color`."""
|
|
119
|
+
return a.get("line_color")
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def axis_zero_line_width(a: Any) -> float:
|
|
123
|
+
"""The axis `line_width`."""
|
|
124
|
+
return a.get("line_width")
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def axis_minor_grid_color(a: Any) -> Any:
|
|
128
|
+
"""`grid_color`."""
|
|
129
|
+
return a.get("grid_color")
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def axis_minor_grid_width(a: Any) -> float:
|
|
133
|
+
"""0.5 × `grid_width`."""
|
|
134
|
+
return 0.5 * a.get("grid_width")
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
def axis_minor_grid_style(a: Any) -> Any:
|
|
138
|
+
"""`grid_style`."""
|
|
139
|
+
return a.get("grid_style")
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def colorbar_orientation(c: Any) -> str:
|
|
143
|
+
"""`vertical` beside the axes or in a grid area, `horizontal` above or below them."""
|
|
144
|
+
if c.plot is None or c.get("position") in ("left", "right"):
|
|
145
|
+
return "vertical"
|
|
146
|
+
return "horizontal"
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
def colorbar_size(c: Any) -> float:
|
|
150
|
+
"""10 pt, in the figure's unit."""
|
|
151
|
+
return 10.0 / c._points_per_unit()
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def colorbar_pad(c: Any) -> float:
|
|
155
|
+
"""8 pt, in the figure's unit."""
|
|
156
|
+
return 8.0 / c._points_per_unit()
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def fill_alpha(s: Any) -> float:
|
|
160
|
+
"""0.3 × the plot's alpha."""
|
|
161
|
+
return 0.3 * s.plot.get("alpha")
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def hist_line_width(h: Any) -> float:
|
|
165
|
+
"""No outline on bars, 1 pt for step outlines."""
|
|
166
|
+
return 0.0 if h.get("kind") == "bar" else 1.0
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def hist_alpha(h: Any) -> float:
|
|
170
|
+
"""0.5 when several value sets overlap (neither stacked nor dodged), else the plot's."""
|
|
171
|
+
if len(h.sets) > 1 and not h.get("stack") and not h.get("dodge"):
|
|
172
|
+
return 0.5
|
|
173
|
+
return h.plot.get("alpha")
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def kde_alpha(k: Any) -> float:
|
|
177
|
+
"""Fill opacity: 1 when stacked, 0.25 otherwise."""
|
|
178
|
+
return 1.0 if k.get("stack") else 0.25
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
def heatmap_label_size(h: Any) -> float:
|
|
182
|
+
"""0.9 × the font size."""
|
|
183
|
+
return 0.9 * h.get("font_size")
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
def contour_label_size(c: Any) -> float:
|
|
187
|
+
"""0.8 × the font size."""
|
|
188
|
+
return 0.8 * c.get("font_size")
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
def text_color(t: Any) -> Any:
|
|
192
|
+
"""The text color."""
|
|
193
|
+
return t.get("text_color")
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
def annotate_text_coords(a: Any) -> str:
|
|
197
|
+
"""As `coords`."""
|
|
198
|
+
return a.get("coords")
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
def annotate_arrow_color(a: Any) -> Any:
|
|
202
|
+
"""The text's `color`."""
|
|
203
|
+
return a.get("color")
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
DEFAULTS: dict[str, Any] = {
|
|
207
|
+
# Inherited settings
|
|
208
|
+
"font_size": 8.0,
|
|
209
|
+
"font_family": "sans-serif",
|
|
210
|
+
"text_color": "black",
|
|
211
|
+
"line_width": 1.0,
|
|
212
|
+
"alpha": 1.0,
|
|
213
|
+
"rasterize": False,
|
|
214
|
+
"simplify": "auto",
|
|
215
|
+
"color_map": "viridis",
|
|
216
|
+
"decimal_separator": ".",
|
|
217
|
+
"thousands_separator": "",
|
|
218
|
+
"minus": "hyphen",
|
|
219
|
+
"prefix": "",
|
|
220
|
+
"suffix": "",
|
|
221
|
+
"precision": None,
|
|
222
|
+
"palette": OKABE_ITO,
|
|
223
|
+
"data": None,
|
|
224
|
+
# Figures: size, arrangement, spacing, output
|
|
225
|
+
"Figure.grid": None,
|
|
226
|
+
"Figure.rows": None,
|
|
227
|
+
"Figure.cols": None,
|
|
228
|
+
"Figure.order": "auto",
|
|
229
|
+
"Figure.align": "axes",
|
|
230
|
+
"Figure.widths": None,
|
|
231
|
+
"Figure.heights": None,
|
|
232
|
+
"Figure.plot_width": figure_plot_width,
|
|
233
|
+
"Figure.plot_height": figure_plot_height,
|
|
234
|
+
"Figure.width": None,
|
|
235
|
+
"Figure.height": None,
|
|
236
|
+
"Figure.unit": "in",
|
|
237
|
+
"Figure.spacing": figure_spacing,
|
|
238
|
+
"Figure.margin": figure_margin,
|
|
239
|
+
"Figure.background": None,
|
|
240
|
+
"Figure.image_background": "white",
|
|
241
|
+
"Figure.dpi": 150.0,
|
|
242
|
+
"Figure.quality": None,
|
|
243
|
+
"Figure.title_rule": None,
|
|
244
|
+
"Figure.title_rule_width": 3.0,
|
|
245
|
+
"Figure.share_x": None,
|
|
246
|
+
"Figure.share_y": None,
|
|
247
|
+
"Figure.share": None,
|
|
248
|
+
"Figure.label_outer": None,
|
|
249
|
+
"Figure.style": None,
|
|
250
|
+
"Figure.scaling": 1.0,
|
|
251
|
+
|
|
252
|
+
# Figure title
|
|
253
|
+
"FigureTitle.text": None,
|
|
254
|
+
"FigureTitle.font_size": figure_title_size,
|
|
255
|
+
"FigureTitle.font_weight": "bold",
|
|
256
|
+
"FigureTitle.align": "center",
|
|
257
|
+
"FigureTitle.over": "axes",
|
|
258
|
+
"FigureTitle.pad": figure_title_pad,
|
|
259
|
+
"FigureTitle.color": figure_title_color,
|
|
260
|
+
|
|
261
|
+
# Plots
|
|
262
|
+
"Plot.spines": frozenset({"bottom", "left"}),
|
|
263
|
+
"Plot.aspect": None,
|
|
264
|
+
"Plot.background": None,
|
|
265
|
+
"Plot.border": None,
|
|
266
|
+
"Plot.border_width": 0.8,
|
|
267
|
+
"Plot.clip": True,
|
|
268
|
+
"Plot.axes": True,
|
|
269
|
+
"Plot.share_x": None,
|
|
270
|
+
"Plot.share_y": None,
|
|
271
|
+
"Plot.share": None,
|
|
272
|
+
|
|
273
|
+
# Plot titles
|
|
274
|
+
"Title.text": None,
|
|
275
|
+
"Title.font_size": title_size,
|
|
276
|
+
"Title.font_weight": "normal",
|
|
277
|
+
"Title.color": title_color,
|
|
278
|
+
"Title.align": "center",
|
|
279
|
+
"Title.pad": 4.0,
|
|
280
|
+
"Title.over": "axes",
|
|
281
|
+
|
|
282
|
+
# Legends
|
|
283
|
+
"Legend.position": "auto",
|
|
284
|
+
"Legend.columns": 1,
|
|
285
|
+
"Legend.frame": False,
|
|
286
|
+
"Legend.title": legend_title,
|
|
287
|
+
"Legend.font_size": legend_font_size,
|
|
288
|
+
"Legend.color": legend_color,
|
|
289
|
+
"Legend.background": "white",
|
|
290
|
+
"Legend.frame_color": "#999999",
|
|
291
|
+
"Legend.pad": 4.0,
|
|
292
|
+
"Legend.frame_width": 0.5,
|
|
293
|
+
"Legend.frame_radius": 0.0,
|
|
294
|
+
"Legend.frame_alpha": 1.0,
|
|
295
|
+
"Legend.glyph_alpha": None,
|
|
296
|
+
"Legend.glyph": "series",
|
|
297
|
+
"Legend.orientation": "auto",
|
|
298
|
+
"Legend.glyph_width": 2.0,
|
|
299
|
+
"Legend.row_height": 1.35,
|
|
300
|
+
|
|
301
|
+
# Axes
|
|
302
|
+
"Axis.label": None,
|
|
303
|
+
"Axis.label_size": axis_font_size,
|
|
304
|
+
"Axis.scale": None,
|
|
305
|
+
"Axis.linthresh": 1.0,
|
|
306
|
+
"Axis.tz": None,
|
|
307
|
+
"Axis.limits": "auto",
|
|
308
|
+
"Axis.padding": "auto",
|
|
309
|
+
"Axis.auto_padding": 0.05,
|
|
310
|
+
"Axis.invert": False,
|
|
311
|
+
"Axis.ticks": None,
|
|
312
|
+
"Axis.tick_labels": None,
|
|
313
|
+
"Axis.minor_ticks": None,
|
|
314
|
+
"Axis.tick_format": "auto",
|
|
315
|
+
"Axis.tick_rotation": "auto",
|
|
316
|
+
"Axis.max_ticks": "auto",
|
|
317
|
+
"Axis.tick_spacing": (3.5, 2.5),
|
|
318
|
+
"Axis.time_tick_spacing": (5.0, 2.5),
|
|
319
|
+
"Axis.auto_max_ticks": (10, 8),
|
|
320
|
+
"Axis.sci_limits": (-4, 5),
|
|
321
|
+
"Axis.tick_length": 3.0,
|
|
322
|
+
"Axis.minor_tick_length": axis_minor_tick_length,
|
|
323
|
+
"Axis.tick_direction": "out",
|
|
324
|
+
"Axis.tick_width": 0.6,
|
|
325
|
+
"Axis.tick_size": axis_font_size,
|
|
326
|
+
"Axis.tick_pad": 2.0,
|
|
327
|
+
"Axis.label_pad": 3.0,
|
|
328
|
+
"Axis.color": axis_color,
|
|
329
|
+
"Axis.line_color": axis_part_color,
|
|
330
|
+
"Axis.tick_color": axis_part_color,
|
|
331
|
+
"Axis.tick_label_color": axis_part_color,
|
|
332
|
+
"Axis.label_color": axis_part_color,
|
|
333
|
+
"Axis.label_weight": "normal",
|
|
334
|
+
"Axis.label_style": "normal",
|
|
335
|
+
"Axis.side": axis_side,
|
|
336
|
+
"Axis.tick_label_weight": "normal",
|
|
337
|
+
"Axis.mirror": False,
|
|
338
|
+
"Axis.spine_offset": 0.0,
|
|
339
|
+
"Axis.spine_trim": False,
|
|
340
|
+
"Axis.include_zero": False,
|
|
341
|
+
"Axis.zero_line": False,
|
|
342
|
+
"Axis.zero_line_color": axis_zero_line_color,
|
|
343
|
+
"Axis.zero_line_width": axis_zero_line_width,
|
|
344
|
+
"Axis.nice": False,
|
|
345
|
+
"Axis.line_width": 0.8,
|
|
346
|
+
"Axis.grid": False,
|
|
347
|
+
"Axis.grid_color": "#dddddd",
|
|
348
|
+
"Axis.grid_width": 0.5,
|
|
349
|
+
"Axis.grid_style": "solid",
|
|
350
|
+
"Axis.minor_grid": False,
|
|
351
|
+
"Axis.minor_grid_color": axis_minor_grid_color,
|
|
352
|
+
"Axis.minor_grid_width": axis_minor_grid_width,
|
|
353
|
+
"Axis.minor_grid_style": axis_minor_grid_style,
|
|
354
|
+
"Axis.visible": True,
|
|
355
|
+
|
|
356
|
+
# Colorbars
|
|
357
|
+
"Colorbar.position": "right",
|
|
358
|
+
"Colorbar.orientation": colorbar_orientation,
|
|
359
|
+
"Colorbar.size": colorbar_size,
|
|
360
|
+
"Colorbar.length": 1.0,
|
|
361
|
+
"Colorbar.pad": colorbar_pad,
|
|
362
|
+
"Colorbar.label": None,
|
|
363
|
+
"Colorbar.extend": "auto",
|
|
364
|
+
"Colorbar.frame": False,
|
|
365
|
+
"Colorbar.frame_color": "#666666",
|
|
366
|
+
"Colorbar.frame_width": 0.5,
|
|
367
|
+
"HLine.color": "#4d4d4d",
|
|
368
|
+
"HLine.line_style": "solid",
|
|
369
|
+
"HLine.min": 0.0,
|
|
370
|
+
"HLine.max": 1.0,
|
|
371
|
+
"HLine.name": None,
|
|
372
|
+
"HLine.alpha": 1.0,
|
|
373
|
+
"HLine.z": 1.0,
|
|
374
|
+
"HLine.extend_limits": False,
|
|
375
|
+
"HLine.clip": True,
|
|
376
|
+
"VLine.color": "#4d4d4d",
|
|
377
|
+
"VLine.line_style": "solid",
|
|
378
|
+
"VLine.min": 0.0,
|
|
379
|
+
"VLine.max": 1.0,
|
|
380
|
+
"VLine.name": None,
|
|
381
|
+
"VLine.alpha": 1.0,
|
|
382
|
+
"VLine.z": 1.0,
|
|
383
|
+
"VLine.extend_limits": False,
|
|
384
|
+
"VLine.clip": True,
|
|
385
|
+
"AxLine.color": "#4d4d4d",
|
|
386
|
+
"AxLine.line_style": "solid",
|
|
387
|
+
"AxLine.name": None,
|
|
388
|
+
"AxLine.alpha": 1.0,
|
|
389
|
+
"AxLine.z": 1.0,
|
|
390
|
+
"AxLine.extend_limits": False,
|
|
391
|
+
"AxLine.clip": True,
|
|
392
|
+
"HSpan.color": "#e5e5e5",
|
|
393
|
+
"HSpan.line_color": None,
|
|
394
|
+
"HSpan.line_width": 0.0,
|
|
395
|
+
"HSpan.min": 0.0,
|
|
396
|
+
"HSpan.max": 1.0,
|
|
397
|
+
"HSpan.name": None,
|
|
398
|
+
"HSpan.alpha": 1.0,
|
|
399
|
+
"HSpan.z": -1.0,
|
|
400
|
+
"HSpan.extend_limits": False,
|
|
401
|
+
"HSpan.clip": True,
|
|
402
|
+
"VSpan.color": "#e5e5e5",
|
|
403
|
+
"VSpan.line_color": None,
|
|
404
|
+
"VSpan.line_width": 0.0,
|
|
405
|
+
"VSpan.min": 0.0,
|
|
406
|
+
"VSpan.max": 1.0,
|
|
407
|
+
"VSpan.name": None,
|
|
408
|
+
"VSpan.alpha": 1.0,
|
|
409
|
+
"VSpan.z": -1.0,
|
|
410
|
+
"VSpan.extend_limits": False,
|
|
411
|
+
"VSpan.clip": True,
|
|
412
|
+
"Text.align": "left",
|
|
413
|
+
"Text.valign": "baseline",
|
|
414
|
+
"Text.rotation": 0.0,
|
|
415
|
+
"Text.coords": "data",
|
|
416
|
+
"Text.color": text_color,
|
|
417
|
+
"Text.font_weight": "normal",
|
|
418
|
+
"Text.name": None,
|
|
419
|
+
"Text.alpha": 1.0,
|
|
420
|
+
"Text.z": 1.0,
|
|
421
|
+
"Text.extend_limits": False,
|
|
422
|
+
"Text.clip": False,
|
|
423
|
+
"Annotate.align": "center",
|
|
424
|
+
"Annotate.valign": "center",
|
|
425
|
+
"Annotate.text_coords": annotate_text_coords,
|
|
426
|
+
"Annotate.arrow": True,
|
|
427
|
+
"Annotate.arrow_style": "->",
|
|
428
|
+
"Annotate.arrow_color": annotate_arrow_color,
|
|
429
|
+
"Annotate.arrow_width": 0.8,
|
|
430
|
+
"Annotate.head_size": 5.0,
|
|
431
|
+
"Annotate.shrink": 2.0,
|
|
432
|
+
|
|
433
|
+
# Every series
|
|
434
|
+
"Series.name": None,
|
|
435
|
+
"Series.z": None,
|
|
436
|
+
|
|
437
|
+
# Scatter
|
|
438
|
+
"Scatter.marker": "circle",
|
|
439
|
+
"Scatter.size": 4.0,
|
|
440
|
+
"Scatter.color": None,
|
|
441
|
+
"Scatter.line_color": None,
|
|
442
|
+
"Scatter.line_width": 0.5,
|
|
443
|
+
"Scatter.filled": True,
|
|
444
|
+
"Scatter.size_basis": "area",
|
|
445
|
+
"Scatter.size_map": None,
|
|
446
|
+
"Scatter.size_legend": True,
|
|
447
|
+
"Scatter.order": None,
|
|
448
|
+
"Scatter.alpha_range": (0.2, 1.0),
|
|
449
|
+
"Scatter.x_error": None,
|
|
450
|
+
"Scatter.y_error": None,
|
|
451
|
+
|
|
452
|
+
# Line
|
|
453
|
+
"Line.color": None,
|
|
454
|
+
"Line.line_style": "solid",
|
|
455
|
+
"Line.interpolation": "linear",
|
|
456
|
+
"Line.missing": "break",
|
|
457
|
+
"Line.cap": "butt",
|
|
458
|
+
"Line.join": "round",
|
|
459
|
+
"Line.marker": "circle",
|
|
460
|
+
"Line.marker_size": 4.0,
|
|
461
|
+
"Line.marker_color": None,
|
|
462
|
+
"Line.marker_line_color": None,
|
|
463
|
+
"Line.marker_line_width": 0.5,
|
|
464
|
+
"Line.marker_filled": True,
|
|
465
|
+
"Line.size_basis": "area",
|
|
466
|
+
"Line.x_error": None,
|
|
467
|
+
"Line.y_error": None,
|
|
468
|
+
"Line.show_markers": False,
|
|
469
|
+
|
|
470
|
+
# Fill
|
|
471
|
+
"Fill.color": None,
|
|
472
|
+
"Fill.alpha": fill_alpha,
|
|
473
|
+
"Fill.line_color": None,
|
|
474
|
+
"Fill.interpolation": "linear",
|
|
475
|
+
"Fill.missing": "break",
|
|
476
|
+
"Fill.orientation": "vertical",
|
|
477
|
+
|
|
478
|
+
# Area
|
|
479
|
+
"Area.baseline": "zero",
|
|
480
|
+
"Area.stack": True,
|
|
481
|
+
"Area.color": None,
|
|
482
|
+
"Area.alpha": 0.85,
|
|
483
|
+
"Area.line_color": None,
|
|
484
|
+
"Area.interpolation": "linear",
|
|
485
|
+
"Area.missing": "break",
|
|
486
|
+
|
|
487
|
+
# Error bars
|
|
488
|
+
"Errorbar.marker": None,
|
|
489
|
+
"Errorbar.marker_size": 4.0,
|
|
490
|
+
"Errorbar.marker_color": None,
|
|
491
|
+
"Errorbar.marker_line_color": None,
|
|
492
|
+
"Errorbar.marker_line_width": 0.0,
|
|
493
|
+
"Errorbar.marker_filled": True,
|
|
494
|
+
"Errorbar.size_basis": "area",
|
|
495
|
+
"Errorbar.color": None,
|
|
496
|
+
"Errorbar.cap": 3.0,
|
|
497
|
+
"Errorbar.x_error": None,
|
|
498
|
+
"Errorbar.y_error": None,
|
|
499
|
+
"Errorbar.y_error_style": "bars",
|
|
500
|
+
"Errorbar.band_alpha": 0.25,
|
|
501
|
+
|
|
502
|
+
# Stem
|
|
503
|
+
"Stem.marker": "circle",
|
|
504
|
+
"Stem.marker_size": 5.0,
|
|
505
|
+
"Stem.marker_color": None,
|
|
506
|
+
"Stem.marker_line_color": None,
|
|
507
|
+
"Stem.marker_line_width": 0.0,
|
|
508
|
+
"Stem.marker_filled": True,
|
|
509
|
+
"Stem.size_basis": "area",
|
|
510
|
+
"Stem.color": None,
|
|
511
|
+
"Stem.baseline": 0.0,
|
|
512
|
+
"Stem.baseline_color": "#4d4d4d",
|
|
513
|
+
"Stem.baseline_width": 0.8,
|
|
514
|
+
"Stem.orientation": "vertical",
|
|
515
|
+
|
|
516
|
+
# Regression
|
|
517
|
+
"Regression.order": 1,
|
|
518
|
+
"Regression.lowess": False,
|
|
519
|
+
"Regression.frac": 0.6666666666666666,
|
|
520
|
+
"Regression.ci": 95.0,
|
|
521
|
+
"Regression.logx": False,
|
|
522
|
+
"Regression.scatter": True,
|
|
523
|
+
"Regression.truncate": True,
|
|
524
|
+
"Regression.points": 100,
|
|
525
|
+
"Regression.color": None,
|
|
526
|
+
"Regression.line_width": 1.5,
|
|
527
|
+
"Regression.line_style": "solid",
|
|
528
|
+
"Regression.band_alpha": 0.2,
|
|
529
|
+
"Regression.marker": "circle",
|
|
530
|
+
"Regression.marker_size": 4.0,
|
|
531
|
+
"Regression.marker_color": None,
|
|
532
|
+
"Regression.marker_line_color": None,
|
|
533
|
+
"Regression.marker_line_width": 0.0,
|
|
534
|
+
"Regression.marker_filled": True,
|
|
535
|
+
"Regression.size_basis": "area",
|
|
536
|
+
|
|
537
|
+
# Bar
|
|
538
|
+
"Bar.color": None,
|
|
539
|
+
"Bar.line_color": None,
|
|
540
|
+
"Bar.line_width": 0.0,
|
|
541
|
+
"Bar.width": 0.8,
|
|
542
|
+
"Bar.bottom": 0.0,
|
|
543
|
+
"Bar.orientation": "vertical",
|
|
544
|
+
"Bar.stack": False,
|
|
545
|
+
"Bar.dodge": True,
|
|
546
|
+
"Bar.gap": 0.0,
|
|
547
|
+
"Bar.saturation": 1.0,
|
|
548
|
+
"Bar.error": None,
|
|
549
|
+
"Bar.error_color": "#333333",
|
|
550
|
+
"Bar.labels": False,
|
|
551
|
+
"Bar.label_format": "auto",
|
|
552
|
+
|
|
553
|
+
# Histogram
|
|
554
|
+
"Hist.bins": "auto",
|
|
555
|
+
"Hist.range": None,
|
|
556
|
+
"Hist.weights": None,
|
|
557
|
+
"Hist.stat": "count",
|
|
558
|
+
"Hist.cumulative": False,
|
|
559
|
+
"Hist.kind": "bar",
|
|
560
|
+
"Hist.bins_scale": "axis",
|
|
561
|
+
"Hist.orientation": "vertical",
|
|
562
|
+
"Hist.stack": False,
|
|
563
|
+
"Hist.dodge": False,
|
|
564
|
+
"Hist.color": None,
|
|
565
|
+
"Hist.line_color": None,
|
|
566
|
+
"Hist.line_width": hist_line_width,
|
|
567
|
+
"Hist.alpha": hist_alpha,
|
|
568
|
+
"Hist.saturation": 1.0,
|
|
569
|
+
"Hist.labels": False,
|
|
570
|
+
"Hist.label_format": "auto",
|
|
571
|
+
|
|
572
|
+
# Density curves
|
|
573
|
+
"Kde.bandwidth": "scott",
|
|
574
|
+
"Kde.adjust": 1.0,
|
|
575
|
+
"Kde.cut": 3.0,
|
|
576
|
+
"Kde.clip": None,
|
|
577
|
+
"Kde.grid": 512,
|
|
578
|
+
"Kde.cumulative": False,
|
|
579
|
+
"Kde.fill": False,
|
|
580
|
+
"Kde.weights": None,
|
|
581
|
+
"Kde.orientation": "vertical",
|
|
582
|
+
"Kde.stack": False,
|
|
583
|
+
"Kde.color": None,
|
|
584
|
+
"Kde.alpha": kde_alpha,
|
|
585
|
+
"Kde.line_style": "solid",
|
|
586
|
+
|
|
587
|
+
# ECDF
|
|
588
|
+
"Ecdf.weights": None,
|
|
589
|
+
"Ecdf.stat": "proportion",
|
|
590
|
+
"Ecdf.complementary": False,
|
|
591
|
+
"Ecdf.orientation": "vertical",
|
|
592
|
+
"Ecdf.color": None,
|
|
593
|
+
"Ecdf.line_style": "solid",
|
|
594
|
+
|
|
595
|
+
# Box plots
|
|
596
|
+
"Box.color": None,
|
|
597
|
+
"Box.line_color": "black",
|
|
598
|
+
"Box.whisker_color": None,
|
|
599
|
+
"Box.whisker_style": "solid",
|
|
600
|
+
"Box.line_width": 0.8,
|
|
601
|
+
"Box.median_color": None,
|
|
602
|
+
"Box.median_width": 1.5,
|
|
603
|
+
"Box.width": 0.8,
|
|
604
|
+
"Box.cap_width": 0.5,
|
|
605
|
+
"Box.whiskers": 1.5,
|
|
606
|
+
"Box.outliers": True,
|
|
607
|
+
"Box.saturation": 1.0,
|
|
608
|
+
"Box.mean": False,
|
|
609
|
+
"Box.mean_marker": "diamond",
|
|
610
|
+
"Box.mean_color": "white",
|
|
611
|
+
"Box.orientation": "vertical",
|
|
612
|
+
"Box.dodge": True,
|
|
613
|
+
"Box.gap": 0.1,
|
|
614
|
+
"Box.categories": None,
|
|
615
|
+
"Box.marker": "circle",
|
|
616
|
+
"Box.marker_size": 3.0,
|
|
617
|
+
"Box.marker_color": None,
|
|
618
|
+
"Box.marker_line_color": None,
|
|
619
|
+
"Box.marker_line_width": 0.6,
|
|
620
|
+
"Box.marker_filled": True,
|
|
621
|
+
"Box.size_basis": "area",
|
|
622
|
+
|
|
623
|
+
# Violins
|
|
624
|
+
"Violin.color": None,
|
|
625
|
+
"Violin.line_color": "#333333",
|
|
626
|
+
"Violin.line_width": 0.8,
|
|
627
|
+
"Violin.saturation": 1.0,
|
|
628
|
+
"Violin.alpha": 1.0,
|
|
629
|
+
"Violin.width": 0.8,
|
|
630
|
+
"Violin.bandwidth": "scott",
|
|
631
|
+
"Violin.adjust": 1.0,
|
|
632
|
+
"Violin.cut": 2.0,
|
|
633
|
+
"Violin.grid": 512,
|
|
634
|
+
"Violin.scale": "area",
|
|
635
|
+
"Violin.inner": "box",
|
|
636
|
+
"Violin.split": False,
|
|
637
|
+
"Violin.orientation": "vertical",
|
|
638
|
+
"Violin.dodge": True,
|
|
639
|
+
"Violin.gap": 0.1,
|
|
640
|
+
"Violin.categories": None,
|
|
641
|
+
"Strip.marker": "circle",
|
|
642
|
+
"Strip.size": 4.0,
|
|
643
|
+
"Strip.color": None,
|
|
644
|
+
"Strip.line_color": None,
|
|
645
|
+
"Strip.line_width": 0.5,
|
|
646
|
+
"Strip.filled": True,
|
|
647
|
+
"Strip.size_basis": "area",
|
|
648
|
+
"Strip.size_map": None,
|
|
649
|
+
"Strip.size_legend": True,
|
|
650
|
+
"Strip.orientation": "vertical",
|
|
651
|
+
"Strip.width": 0.8,
|
|
652
|
+
"Strip.dodge": True,
|
|
653
|
+
"Strip.gap": 0.0,
|
|
654
|
+
"Strip.categories": None,
|
|
655
|
+
"Strip.jitter": 0.1,
|
|
656
|
+
"Strip.seed": 0,
|
|
657
|
+
"Strip.order": None,
|
|
658
|
+
"Strip.alpha_range": (0.2, 1.0),
|
|
659
|
+
"Swarm.marker": "circle",
|
|
660
|
+
"Swarm.size": 4.0,
|
|
661
|
+
"Swarm.color": None,
|
|
662
|
+
"Swarm.line_color": None,
|
|
663
|
+
"Swarm.line_width": 0.5,
|
|
664
|
+
"Swarm.filled": True,
|
|
665
|
+
"Swarm.size_basis": "area",
|
|
666
|
+
"Swarm.size_map": None,
|
|
667
|
+
"Swarm.size_legend": True,
|
|
668
|
+
"Swarm.orientation": "vertical",
|
|
669
|
+
"Swarm.width": 0.8,
|
|
670
|
+
"Swarm.dodge": True,
|
|
671
|
+
"Swarm.gap": 0.0,
|
|
672
|
+
"Swarm.categories": None,
|
|
673
|
+
"Swarm.order": None,
|
|
674
|
+
"Swarm.alpha_range": (0.2, 1.0),
|
|
675
|
+
|
|
676
|
+
# Heatmaps
|
|
677
|
+
"Heatmap.color_limits": None,
|
|
678
|
+
"Heatmap.color_scale": None,
|
|
679
|
+
"Heatmap.mode": "image",
|
|
680
|
+
"Heatmap.nan_color": None,
|
|
681
|
+
"Heatmap.origin": "top",
|
|
682
|
+
"Heatmap.labels": False,
|
|
683
|
+
"Heatmap.label_format": "auto",
|
|
684
|
+
"Heatmap.label_size": heatmap_label_size,
|
|
685
|
+
"Heatmap.colorbar": False,
|
|
686
|
+
|
|
687
|
+
# 2-D histograms
|
|
688
|
+
"Hist2d.bins": ("auto", "auto"),
|
|
689
|
+
"Hist2d.range": None,
|
|
690
|
+
"Hist2d.weights": None,
|
|
691
|
+
"Hist2d.stat": "count",
|
|
692
|
+
"Hist2d.min_count": 1.0,
|
|
693
|
+
"Hist2d.origin": "bottom",
|
|
694
|
+
|
|
695
|
+
# Hexagonal bins
|
|
696
|
+
"Hexbin.gridsize": 30,
|
|
697
|
+
"Hexbin.weights": None,
|
|
698
|
+
"Hexbin.stat": "count",
|
|
699
|
+
"Hexbin.min_count": 1.0,
|
|
700
|
+
"Hexbin.color_limits": None,
|
|
701
|
+
"Hexbin.color_scale": None,
|
|
702
|
+
"Hexbin.line_color": None,
|
|
703
|
+
"Hexbin.line_width": 0.0,
|
|
704
|
+
"Hexbin.colorbar": False,
|
|
705
|
+
|
|
706
|
+
# Contours
|
|
707
|
+
"Contour.levels": 10,
|
|
708
|
+
"Contour.filled": False,
|
|
709
|
+
"Contour.lines": True,
|
|
710
|
+
"Contour.colors": None,
|
|
711
|
+
"Contour.line_width": 0.8,
|
|
712
|
+
"Contour.line_style": "solid",
|
|
713
|
+
"Contour.negative_style": None,
|
|
714
|
+
"Contour.alpha": 1.0,
|
|
715
|
+
"Contour.labels": False,
|
|
716
|
+
"Contour.label_format": "auto",
|
|
717
|
+
"Contour.label_size": contour_label_size,
|
|
718
|
+
"Contour.colorbar": False,
|
|
719
|
+
|
|
720
|
+
# 2-D densities (contours of a density)
|
|
721
|
+
"Kde2d.thresh": 0.05,
|
|
722
|
+
"Kde2d.bandwidth": "scott",
|
|
723
|
+
"Kde2d.adjust": 1.0,
|
|
724
|
+
"Kde2d.cut": 3.0,
|
|
725
|
+
"Kde2d.gridsize": 128,
|
|
726
|
+
"Kde2d.color": None,
|
|
727
|
+
|
|
728
|
+
# Pies
|
|
729
|
+
"Pie.labels": None,
|
|
730
|
+
"Pie.colors": None,
|
|
731
|
+
"Pie.start": 90.0,
|
|
732
|
+
"Pie.counterclockwise": True,
|
|
733
|
+
"Pie.hole": 0.0,
|
|
734
|
+
"Pie.explode": None,
|
|
735
|
+
"Pie.sort": False,
|
|
736
|
+
"Pie.label_position": "outside",
|
|
737
|
+
"Pie.value_labels": False,
|
|
738
|
+
"Pie.label_format": "auto",
|
|
739
|
+
"Pie.line_color": "white",
|
|
740
|
+
"Pie.line_width": 1.0,
|
|
741
|
+
"Pie.alpha": 1.0,
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
|
|
745
|
+
def inherited() -> dict[str, Any]:
|
|
746
|
+
"""The inherited settings of ``DEFAULTS`` (bare names): the base styles merge over."""
|
|
747
|
+
return {k: v for k, v in DEFAULTS.items() if "." not in k}
|
|
748
|
+
|
|
749
|
+
|
|
750
|
+
_MISSING = object()
|
|
751
|
+
|
|
752
|
+
|
|
753
|
+
def class_default(cls: type, name: str) -> Any:
|
|
754
|
+
"""The ``DEFAULTS`` entry of setting ``name`` of ``cls``, along its MRO (a value or a
|
|
755
|
+
function of the object)."""
|
|
756
|
+
for c in cls.__mro__:
|
|
757
|
+
d = DEFAULTS.get(f"{c.__name__}.{name}", _MISSING)
|
|
758
|
+
if d is not _MISSING:
|
|
759
|
+
return d
|
|
760
|
+
raise KeyError(f"no default for {cls.__name__}.{name}")
|
|
761
|
+
|
|
762
|
+
|
|
763
|
+
def default_of(obj: Any, name: str) -> Any:
|
|
764
|
+
"""The default of setting ``name`` of ``obj``."""
|
|
765
|
+
d = class_default(type(obj), name)
|
|
766
|
+
return d(obj) if callable(d) else d
|