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.
Files changed (65) hide show
  1. plot_io/__init__.py +66 -0
  2. plot_io/_backend.py +114 -0
  3. plot_io/axis.py +574 -0
  4. plot_io/colorbar.py +342 -0
  5. plot_io/decorations.py +496 -0
  6. plot_io/defaults.py +766 -0
  7. plot_io/density.py +97 -0
  8. plot_io/enums.py +63 -0
  9. plot_io/facets.py +184 -0
  10. plot_io/figure.py +331 -0
  11. plot_io/labels.py +63 -0
  12. plot_io/legend.py +498 -0
  13. plot_io/limits.py +92 -0
  14. plot_io/maps/__init__.py +365 -0
  15. plot_io/maps/data.py +333 -0
  16. plot_io/markers.py +117 -0
  17. plot_io/numbers.py +289 -0
  18. plot_io/occupancy.py +219 -0
  19. plot_io/palettes.py +142 -0
  20. plot_io/plot.py +435 -0
  21. plot_io/render.py +1122 -0
  22. plot_io/scales.py +93 -0
  23. plot_io/series/__init__.py +498 -0
  24. plot_io/series/area.py +181 -0
  25. plot_io/series/bar.py +294 -0
  26. plot_io/series/box.py +401 -0
  27. plot_io/series/catdata.py +23 -0
  28. plot_io/series/catpoints.py +182 -0
  29. plot_io/series/contour.py +294 -0
  30. plot_io/series/curves.py +128 -0
  31. plot_io/series/ecdf.py +143 -0
  32. plot_io/series/errorbar.py +111 -0
  33. plot_io/series/errors.py +100 -0
  34. plot_io/series/fill.py +168 -0
  35. plot_io/series/heatmap.py +304 -0
  36. plot_io/series/hexbin.py +216 -0
  37. plot_io/series/hist.py +379 -0
  38. plot_io/series/hist2d.py +163 -0
  39. plot_io/series/kde.py +228 -0
  40. plot_io/series/kde2d.py +153 -0
  41. plot_io/series/line.py +173 -0
  42. plot_io/series/pie.py +304 -0
  43. plot_io/series/points.py +341 -0
  44. plot_io/series/regression.py +250 -0
  45. plot_io/series/scatter.py +103 -0
  46. plot_io/series/stem.py +112 -0
  47. plot_io/series/violin.py +321 -0
  48. plot_io/settings.py +281 -0
  49. plot_io/shapes.py +57 -0
  50. plot_io/sharing.py +160 -0
  51. plot_io/slots.py +52 -0
  52. plot_io/stacking.py +63 -0
  53. plot_io/stats.py +140 -0
  54. plot_io/style.py +71 -0
  55. plot_io/styles/__init__.py +234 -0
  56. plot_io/styles/library.py +732 -0
  57. plot_io/tables.py +141 -0
  58. plot_io/text.py +109 -0
  59. plot_io/ticks.py +284 -0
  60. plot_io/times.py +199 -0
  61. plot_io/values.py +161 -0
  62. plot_io-0.1.0.dist-info/METADATA +102 -0
  63. plot_io-0.1.0.dist-info/RECORD +65 -0
  64. plot_io-0.1.0.dist-info/WHEEL +4 -0
  65. plot_io-0.1.0.dist-info/licenses/LICENSE +28 -0
@@ -0,0 +1,732 @@
1
+ """Bundled styles: the defaults of common plotting libraries, in plot_io's settings.
2
+
3
+ Lengths are points (CSS px × 0.75; R's ggplot2 linewidth L mm → L × 72.27 / 25.4 × 0.75
4
+ pt). The source of every value is listed in the plan's reference sheet.
5
+ """
6
+
7
+ from . import register_style
8
+
9
+ #: An open "+" (two strokes): matplotlib's and MATLAB's outlier marker
10
+ _PLUS = "M-0.5 0 H0.5 M0 -0.5 V0.5"
11
+
12
+ register_style("default", {})
13
+
14
+ # -- matplotlib (rcParams defaults, ≥ 2.0) --------------------------------------------
15
+
16
+ register_style("matplotlib", {
17
+ "font_family": "DejaVu Sans, Bitstream Vera Sans, Arial, Helvetica, sans-serif",
18
+ "font_size": 10.0,
19
+ "text_color": "black",
20
+ "line_width": 1.5,
21
+ "palette": "tab10",
22
+ "color_map": "viridis",
23
+ "Figure.background": "white",
24
+ "Plot.spines": "all",
25
+ "Title.pad": 6.0,
26
+ "FigureTitle.font_size": 12.0, # suptitle: "large", normal weight
27
+ "FigureTitle.font_weight": "normal",
28
+ "Axis.line_width": 0.8,
29
+ "Axis.tick_length": 3.5,
30
+ "Axis.minor_tick_length": 2.0,
31
+ "Axis.tick_width": 0.8,
32
+ "Axis.tick_pad": 3.5,
33
+ "Axis.label_pad": 4.0,
34
+ "Axis.grid_color": "#b0b0b0",
35
+ "Axis.grid_width": 0.8,
36
+ "Legend.frame": True,
37
+ "Legend.frame_color": "#cccccc",
38
+ "Legend.frame_width": 1.0,
39
+ "Legend.frame_alpha": 0.8,
40
+ "Legend.frame_radius": 3.0,
41
+ "Legend.row_height": 1.5,
42
+ "Scatter.size": 6.0,
43
+ "Line.marker_size": 6.0,
44
+ "Box.color": "none",
45
+ "Box.line_color": "black",
46
+ "Box.line_width": 1.0,
47
+ "Box.median_color": "C1",
48
+ "Box.median_width": 1.0,
49
+ "Box.width": 0.5,
50
+ "Box.marker_color": "none",
51
+ "Box.marker_line_color": "black",
52
+ "Box.marker_line_width": 1.0,
53
+ "Box.marker_size": 6.0,
54
+ "Colorbar.frame": True,
55
+ "Colorbar.frame_color": "black",
56
+ "Colorbar.frame_width": 0.8,
57
+ })
58
+
59
+ register_style("matplotlib-classic", {
60
+ "base": "matplotlib",
61
+ "font_size": 12.0,
62
+ "line_width": 1.0,
63
+ "palette": "matplotlib_classic",
64
+ "color_map": "jet",
65
+ "Title.pad": 5.0,
66
+ "Axis.line_width": 1.0,
67
+ "Axis.tick_length": 4.0,
68
+ "Axis.tick_width": 0.5,
69
+ "Axis.tick_direction": "in",
70
+ "Axis.mirror": True,
71
+ "Axis.tick_pad": 4.0,
72
+ "Axis.label_pad": 5.0,
73
+ "Axis.padding": 0.0,
74
+ "Axis.nice": True,
75
+ "Legend.position": "top right",
76
+ "Legend.frame_color": "black",
77
+ "Legend.frame_alpha": 1.0,
78
+ "Legend.frame_radius": 0.0,
79
+ "Scatter.size": 4.47,
80
+ "Scatter.line_color": "black",
81
+ "Scatter.line_width": 0.5,
82
+ "Box.line_color": "#0000ff",
83
+ "Box.median_color": "#ff0000",
84
+ "Box.whisker_style": "dashed",
85
+ "Box.marker": _PLUS,
86
+ "Box.marker_color": "#0000ff",
87
+ "Box.marker_filled": False,
88
+ "Box.marker_line_width": 1.0,
89
+ "Box.size_basis": "box",
90
+ })
91
+
92
+ # -- seaborn (0.13: axes_style, plotting_context "notebook", "deep") ---------------------
93
+
94
+ register_style("seaborn", {
95
+ "font_family": "Arial, DejaVu Sans, Liberation Sans, Bitstream Vera Sans, sans-serif",
96
+ "font_size": 12.0,
97
+ "text_color": "#262626",
98
+ "line_width": 1.5,
99
+ "palette": "deep",
100
+ "color_map": "rocket",
101
+ "Figure.background": "white",
102
+ "Plot.background": "#EAEAF2",
103
+ "Plot.spines": "none",
104
+ "Title.font_size": 12.0,
105
+ "Title.pad": 6.0,
106
+ "FigureTitle.font_size": 14.4,
107
+ "FigureTitle.font_weight": "normal",
108
+ "Axis.tick_size": 11.0,
109
+ "Axis.tick_length": 0.0,
110
+ "Axis.tick_pad": 3.5,
111
+ "Axis.label_pad": 4.0,
112
+ "Axis.line_width": 1.25,
113
+ "Axis.grid": True,
114
+ "Axis.grid_color": "white",
115
+ "Axis.grid_width": 1.0,
116
+ "Legend.font_size": 11.0,
117
+ "Legend.frame": True,
118
+ "Legend.frame_color": "#cccccc",
119
+ "Legend.frame_width": 1.0,
120
+ "Legend.frame_alpha": 0.8,
121
+ "Legend.frame_radius": 3.0,
122
+ "Legend.row_height": 1.5,
123
+ "Scatter.size": 6.0,
124
+ "Scatter.line_color": "white",
125
+ "Scatter.line_width": 0.48,
126
+ "Line.marker_size": 6.0,
127
+ "Box.saturation": 0.75,
128
+ "Box.line_color": "auto",
129
+ "Box.line_width": 1.0,
130
+ "Box.median_width": 1.0,
131
+ "Box.marker_color": "none",
132
+ "Box.marker_line_width": 1.0,
133
+ "Box.marker_size": 5.0,
134
+ })
135
+
136
+ register_style("seaborn-darkgrid", {"base": "seaborn"})
137
+ register_style("seaborn-whitegrid", {
138
+ "base": "seaborn",
139
+ "Plot.background": "white",
140
+ "Plot.spines": "all",
141
+ "Axis.line_color": "#cccccc",
142
+ "Axis.grid_color": "#cccccc",
143
+ })
144
+ register_style("seaborn-dark", {"base": "seaborn", "Axis.grid": False})
145
+ register_style("seaborn-white", {
146
+ "base": "seaborn",
147
+ "Plot.background": "white",
148
+ "Plot.spines": "all",
149
+ "Axis.grid": False,
150
+ })
151
+ register_style("seaborn-ticks", {
152
+ "base": "seaborn-white",
153
+ "Axis.tick_length": 6.0,
154
+ "Axis.minor_tick_length": 4.0,
155
+ "Axis.tick_width": 1.25,
156
+ })
157
+ register_style("seaborn-paper", {"base": "seaborn", "Figure.scaling": 0.8})
158
+ register_style("seaborn-talk", {"base": "seaborn", "Figure.scaling": 1.5})
159
+ register_style("seaborn-poster", {"base": "seaborn", "Figure.scaling": 2.0})
160
+
161
+ # -- ggplot2 (theme_grey(base_size = 11), hue_pal, scale_colour_gradient) -----------------
162
+
163
+ _GG_LINE = 0.5 * 72.27 / 25.4 * 0.75 # base_line_size 0.5 mm → 1.07 pt
164
+
165
+ register_style("ggplot2", {
166
+ "font_family": "Helvetica, Arial, Liberation Sans, sans-serif",
167
+ "font_size": 11.0,
168
+ "text_color": "black",
169
+ "line_width": _GG_LINE,
170
+ "palette": "hue",
171
+ "color_map": "ggplot2",
172
+ "Figure.background": "white",
173
+ "Plot.background": "#EBEBEB",
174
+ "Plot.spines": "none",
175
+ "Title.font_size": 13.2,
176
+ "Title.align": "left",
177
+ "Title.pad": 5.5,
178
+ "FigureTitle.font_size": 13.2,
179
+ "FigureTitle.font_weight": "normal",
180
+ "FigureTitle.align": "left",
181
+ "Axis.tick_size": 8.8,
182
+ "Axis.tick_label_color": "#4D4D4D",
183
+ "Axis.tick_color": "#333333",
184
+ "Axis.tick_length": 2.75,
185
+ "Axis.tick_width": _GG_LINE,
186
+ "Axis.tick_pad": 2.2,
187
+ "Axis.label_pad": 2.75,
188
+ "Axis.grid": True,
189
+ "Axis.grid_color": "white",
190
+ "Axis.grid_width": _GG_LINE,
191
+ "Axis.minor_grid": True,
192
+ "Axis.minor_grid_width": _GG_LINE / 2,
193
+ "Legend.position": "outside right",
194
+ "Legend.font_size": 8.8,
195
+ "Legend.glyph_width": 1.8,
196
+ "Legend.row_height": 1.8,
197
+ "Legend.pad": 11.0,
198
+ "Scatter.size": 4.3,
199
+ "Line.marker_size": 4.3,
200
+ "Box.color": "white",
201
+ "Box.line_color": "#333333",
202
+ "Box.line_width": _GG_LINE,
203
+ "Box.median_width": 2 * _GG_LINE,
204
+ "Box.width": 0.75,
205
+ "Box.cap_width": 0.0,
206
+ "Box.marker_color": "black",
207
+ "Box.marker_size": 4.3,
208
+ "Colorbar.tick_color": "white", # guide_colourbar: white ticks inside
209
+ "Colorbar.tick_direction": "in",
210
+ "Colorbar.tick_length": 2.0,
211
+ "Colorbar.mirror": True,
212
+ })
213
+
214
+ register_style("ggplot2-bw", {
215
+ "base": "ggplot2",
216
+ "Plot.background": "white",
217
+ "Plot.border": "#333333",
218
+ "Plot.border_width": _GG_LINE,
219
+ "Axis.grid_color": "#EBEBEB",
220
+ })
221
+ register_style("ggplot2-light", {
222
+ "base": "ggplot2",
223
+ "Plot.background": "white",
224
+ "Plot.border": "#B3B3B3",
225
+ "Plot.border_width": _GG_LINE,
226
+ "Axis.grid_color": "#DEDEDE",
227
+ "Axis.grid_width": _GG_LINE / 2,
228
+ "Axis.minor_grid_width": _GG_LINE / 4,
229
+ "Axis.tick_color": "#B3B3B3",
230
+ "Axis.tick_width": _GG_LINE / 2,
231
+ })
232
+ register_style("ggplot2-minimal", {
233
+ "base": "ggplot2",
234
+ "Plot.background": "white",
235
+ "Axis.grid_color": "#EBEBEB",
236
+ "Axis.tick_length": 0.0,
237
+ "Axis.tick_pad": 4.95,
238
+ })
239
+ register_style("ggplot2-classic", {
240
+ "base": "ggplot2",
241
+ "Plot.background": "white",
242
+ "Plot.spines": "left bottom",
243
+ "Axis.line_color": "black",
244
+ "Axis.line_width": _GG_LINE,
245
+ "Axis.tick_color": "black",
246
+ "Axis.grid": False,
247
+ "Axis.minor_grid": False,
248
+ })
249
+
250
+ # -- altair (Vega-Lite / Vega default config) -------------------------------------------
251
+
252
+ register_style("altair", {
253
+ "font_family": "sans-serif",
254
+ "font_size": 7.5, # guide-label 10 px
255
+ "text_color": "black",
256
+ "line_width": 1.5, # line strokeWidth 2 px
257
+ "palette": "tableau10",
258
+ "color_map": "ylgnbu",
259
+ "Figure.background": "white",
260
+ "Plot.border": "#DDDDDD", # view stroke
261
+ "Plot.border_width": 0.75,
262
+ "Title.font_size": 9.75, # group-title 13 px bold
263
+ "Title.font_weight": "bold",
264
+ "Title.pad": 3.0,
265
+ "FigureTitle.font_size": 9.75,
266
+ "Axis.label_size": 8.25, # guide-title 11 px bold
267
+ "Axis.label_weight": "bold",
268
+ "Axis.line_color": "#888888",
269
+ "Axis.line_width": 0.75,
270
+ "Axis.tick_color": "#888888",
271
+ "Axis.tick_length": 3.75,
272
+ "Axis.tick_width": 0.75,
273
+ "Axis.tick_pad": 1.5,
274
+ "Axis.label_pad": 3.0,
275
+ "Axis.grid": True,
276
+ "Axis.grid_color": "#DDDDDD",
277
+ "Axis.grid_width": 0.75,
278
+ "Axis.padding": 0.0,
279
+ "Axis.nice": True,
280
+ "Axis.include_zero": "auto",
281
+ "Legend.position": "outside right",
282
+ "Legend.pad": 13.5,
283
+ "Scatter.size": 4.6, # point size 30 px², stroke 2 px, not filled
284
+ "Scatter.filled": False,
285
+ "Scatter.line_width": 1.5,
286
+ "Line.marker_size": 4.6,
287
+ "Box.line_color": "black",
288
+ "Box.line_width": 0.75,
289
+ "Box.median_color": "white",
290
+ "Box.median_width": 1.5,
291
+ "Box.width": 0.5,
292
+ "Box.marker_filled": False,
293
+ "Box.marker_line_width": 1.5,
294
+ "Box.marker_size": 4.6,
295
+ })
296
+
297
+ # -- MATLAB (R2014b+ default property values) -------------------------------------------
298
+
299
+ register_style("matlab", {
300
+ "font_family": "Helvetica, Arial, Liberation Sans, sans-serif",
301
+ "font_size": 10.0,
302
+ "text_color": "#262626",
303
+ "line_width": 0.5,
304
+ "palette": "matlab",
305
+ "color_map": "parula",
306
+ "Figure.background": "white",
307
+ "Title.font_size": 11.0,
308
+ "Title.font_weight": "bold",
309
+ "Title.pad": 5.0,
310
+ "FigureTitle.font_size": 11.0, # sgtitle
311
+ "FigureTitle.font_weight": "normal",
312
+ "Axis.label_size": 11.0,
313
+ "Axis.line_width": 0.5,
314
+ "Axis.tick_direction": "in",
315
+ "Axis.tick_length": 3.2,
316
+ "Axis.tick_width": 0.5,
317
+ "Axis.grid_color": "#dbdbdb",
318
+ "Axis.padding": 0.0,
319
+ "Axis.nice": True,
320
+ "Legend.position": "top right",
321
+ "Legend.font_size": 9.0,
322
+ "Legend.frame": True,
323
+ "Legend.frame_color": "#262626",
324
+ "Legend.frame_width": 0.5,
325
+ "Scatter.size": 6.0,
326
+ "Scatter.filled": False,
327
+ "Scatter.line_width": 0.5,
328
+ "Line.marker_size": 6.0,
329
+ "Box.color": "none",
330
+ "Box.line_color": "#0000ff",
331
+ "Box.line_width": 0.5,
332
+ "Box.median_color": "#ff0000",
333
+ "Box.median_width": 0.5,
334
+ "Box.whisker_color": "black",
335
+ "Box.whisker_style": "dashed",
336
+ "Box.width": 0.5,
337
+ "Box.marker": _PLUS,
338
+ "Box.marker_color": "#ff0000",
339
+ "Box.marker_filled": False,
340
+ "Box.marker_line_width": 0.5,
341
+ "Box.marker_size": 6.0,
342
+ "Box.size_basis": "box",
343
+ "Colorbar.frame": True,
344
+ "Colorbar.frame_color": "#262626",
345
+ })
346
+
347
+ register_style("matlab-box", {"base": "matlab", "Plot.spines": "all", "Axis.mirror": True})
348
+
349
+ # -- Chart.js 4 (core defaults, colors plugin) ------------------------------------------
350
+
351
+ register_style("chartjs", {
352
+ "font_family": "Helvetica Neue, Helvetica, Arial, sans-serif",
353
+ "font_size": 9.0, # 12 px
354
+ "text_color": "#666666",
355
+ "line_width": 2.25, # line borderWidth 3 px
356
+ "palette": "chartjs",
357
+ "Figure.background": "white",
358
+ "Title.font_size": 9.0,
359
+ "Title.font_weight": "bold",
360
+ "Title.pad": 7.5,
361
+ "FigureTitle.font_size": 9.0,
362
+ "Axis.line_color": "#0000001A",
363
+ "Axis.line_width": 0.75,
364
+ "Axis.tick_color": "#0000001A",
365
+ "Axis.tick_length": 6.0, # tickLength 8 px
366
+ "Axis.tick_width": 0.75,
367
+ "Axis.tick_pad": 2.25,
368
+ "Axis.grid": True,
369
+ "Axis.grid_color": "#0000001A",
370
+ "Axis.grid_width": 0.75,
371
+ "Legend.position": "outside top",
372
+ "Legend.glyph": "box",
373
+ "Legend.glyph_alpha": 0.5,
374
+ "Legend.glyph_width": 3.33, # boxWidth 40 px
375
+ "Legend.row_height": 1.67,
376
+ "Legend.pad": 7.5,
377
+ "Scatter.size": 4.5, # radius 3 px
378
+ "Scatter.filled": 0.5, # background: the color at 0.5
379
+ "Scatter.line_width": 0.75,
380
+ "Line.show_markers": True,
381
+ "Line.marker_size": 4.5,
382
+ "Line.marker_filled": 0.5,
383
+ "Line.marker_line_width": 0.75,
384
+ "Fill.alpha": 0.5,
385
+ "Box.alpha": 0.5,
386
+ "Box.line_color": "#666666",
387
+ "Box.line_width": 0.75,
388
+ "Box.median_width": 1.5,
389
+ })
390
+
391
+ # -- plotly (plotly.py "plotly" and "plotly_white" templates, plotly.js defaults) --------
392
+
393
+ register_style("plotly", {
394
+ "font_family": "Open Sans, verdana, arial, sans-serif",
395
+ "font_size": 9.0, # 12 px
396
+ "text_color": "#2a3f5f",
397
+ "line_width": 1.5, # 2 px
398
+ "palette": "plotly",
399
+ "color_map": "plasma",
400
+ "Figure.background": "white",
401
+ "Plot.background": "#E5ECF6",
402
+ "Plot.spines": "none",
403
+ "Title.font_size": 12.75, # 17 px
404
+ "Title.align": "left",
405
+ "Title.over": "plot",
406
+ "Title.pad": 7.5,
407
+ "FigureTitle.font_size": 12.75,
408
+ "FigureTitle.font_weight": "normal",
409
+ "FigureTitle.align": "left",
410
+ "FigureTitle.over": "figure",
411
+ "Axis.tick_length": 0.0,
412
+ "Axis.tick_pad": 4.0,
413
+ "Axis.label_pad": 6.0,
414
+ "Axis.grid": True,
415
+ "Axis.grid_color": "white",
416
+ "Axis.grid_width": 0.75,
417
+ "Axis.zero_line": True,
418
+ "Axis.zero_line_color": "white",
419
+ "Axis.zero_line_width": 1.5,
420
+ "Legend.position": "outside right",
421
+ "Legend.pad": 7.5,
422
+ "Scatter.size": 4.5, # 6 px
423
+ "Line.marker_size": 4.5,
424
+ "Box.alpha": 0.5,
425
+ "Box.line_color": "series",
426
+ "Box.line_width": 1.5,
427
+ "Box.median_width": 1.5,
428
+ "Box.width": 0.5,
429
+ "Box.cap_width": 0.0,
430
+ "Box.marker_size": 4.5,
431
+ })
432
+
433
+ register_style("plotly-white", {
434
+ "base": "plotly",
435
+ "Plot.background": "white",
436
+ "Axis.grid_color": "#EBF0F8",
437
+ "Axis.zero_line_color": "#EBF0F8",
438
+ })
439
+
440
+ # -- Bokeh (3.x model defaults) ---------------------------------------------------------
441
+
442
+ register_style("bokeh", {
443
+ "font_family": "Helvetica, Arial, Liberation Sans, sans-serif",
444
+ "font_size": 8.25, # major labels 11 px
445
+ "text_color": "#444444",
446
+ "line_width": 0.75, # 1 px
447
+ "palette": "tab10", # Category10
448
+ "color_map": "viridis",
449
+ "Figure.background": "white",
450
+ "Plot.border": "#e5e5e5", # outline_line_color
451
+ "Plot.border_width": 0.75,
452
+ "Title.font_size": 9.75, # 13 px bold, left
453
+ "Title.font_weight": "bold",
454
+ "Title.align": "left",
455
+ "FigureTitle.font_size": 9.75,
456
+ "FigureTitle.align": "left",
457
+ "Axis.label_size": 9.75, # 13 px italic
458
+ "Axis.label_style": "italic",
459
+ "Axis.color": "black",
460
+ "Axis.tick_label_color": "#444444",
461
+ "Axis.label_color": "#444444",
462
+ "Axis.line_width": 0.75,
463
+ "Axis.tick_width": 0.75,
464
+ "Axis.tick_length": 4.5, # major_tick_out 6 px
465
+ "Axis.minor_tick_length": 3.0, # minor_tick_out 4 px
466
+ "Axis.minor_ticks": True,
467
+ "Axis.tick_pad": 3.75, # major_label_standoff 5 px
468
+ "Axis.label_pad": 3.75, # axis_label_standoff 5 px
469
+ "Axis.grid": True,
470
+ "Axis.grid_color": "#e5e5e5",
471
+ "Axis.grid_width": 0.75,
472
+ "Legend.position": "top right",
473
+ "Legend.frame": True,
474
+ "Legend.frame_color": "#00000080", # black, alpha 0.5
475
+ "Legend.frame_alpha": 0.95,
476
+ "Legend.frame_width": 0.75,
477
+ "Legend.font_size": 9.75, # 13 px
478
+ "Legend.glyph_width": 1.54, # 20 px glyphs
479
+ "Legend.row_height": 1.54,
480
+ "Scatter.size": 3.0, # size 4 px
481
+ })
482
+
483
+ # -- Observable Plot (defaults of @observablehq/plot) -----------------------------------
484
+
485
+ register_style("observable", {
486
+ "font_family": "system-ui, sans-serif",
487
+ "font_size": 7.5, # 10 px
488
+ "text_color": "black",
489
+ "line_width": 1.125, # 1.5 px
490
+ "palette": "observable10",
491
+ "color_map": "turbo",
492
+ "Figure.background": "white",
493
+ "Plot.spines": "none",
494
+ "Axis.tick_length": 4.5, # tickSize 6 px
495
+ "Axis.tick_width": 0.75,
496
+ "Axis.tick_pad": 2.25, # tickPadding 3 px
497
+ "Legend.position": "outside top",
498
+ "Legend.glyph": "box", # square swatches
499
+ "Legend.glyph_width": 1.2,
500
+ "Legend.row_height": 1.5,
501
+ "Scatter.size": 4.5, # r 3 px, not filled, stroke 1.5 px
502
+ "Scatter.filled": False,
503
+ "Scatter.line_width": 1.125,
504
+ "Box.color": "#cccccc",
505
+ "Box.line_color": "black",
506
+ "Box.line_width": 0.75,
507
+ "Box.median_width": 1.5,
508
+ "Box.width": 0.6,
509
+ "Box.cap_width": 0.0,
510
+ "Box.marker_color": "black",
511
+ "Box.marker_size": 2.25,
512
+ })
513
+
514
+ # -- Excel (2013+ default chart, Office 2013 theme) -------------------------------------
515
+
516
+ register_style("excel", {
517
+ "font_family": "Carlito, Calibri, Liberation Sans, sans-serif",
518
+ "font_size": 9.0,
519
+ "text_color": "#595959",
520
+ "line_width": 2.25,
521
+ "palette": "office",
522
+ "Figure.background": "white",
523
+ "Plot.spines": "bottom",
524
+ "Title.font_size": 14.0,
525
+ "FigureTitle.font_size": 14.0,
526
+ "FigureTitle.font_weight": "normal",
527
+ "Axis.line_color": "#D9D9D9",
528
+ "Axis.line_width": 0.75,
529
+ "Axis.tick_length": 0.0,
530
+ "Axis.tick_pad": 4.0,
531
+ "YAxis.grid": True,
532
+ "Axis.grid_color": "#D9D9D9",
533
+ "Axis.grid_width": 0.75,
534
+ "Legend.position": "outside bottom",
535
+ "Scatter.size": 5.0,
536
+ "Box.line_color": "#595959",
537
+ "Box.line_width": 0.75,
538
+ "Box.median_width": 0.75,
539
+ "Box.mean": True,
540
+ "Box.mean_marker": "cross",
541
+ "Box.mean_color": "#595959",
542
+ })
543
+
544
+ # -- FiveThirtyEight (matplotlib's fivethirtyeight style) --------------------------------
545
+
546
+ register_style("fivethirtyeight", {
547
+ "base": "matplotlib",
548
+ "font_size": 14.0,
549
+ "line_width": 4.0,
550
+ "palette": "fivethirtyeight",
551
+ "Figure.background": "#f0f0f0",
552
+ "Plot.background": "#f0f0f0",
553
+ "Plot.spines": "none",
554
+ "Title.font_size": 20.16, # x-large
555
+ "FigureTitle.font_size": 20.16,
556
+ "Axis.label_size": 16.8, # large
557
+ "Axis.tick_length": 0.0,
558
+ "Axis.grid": True,
559
+ "Axis.grid_color": "#cbcbcb",
560
+ "Axis.grid_width": 1.0,
561
+ "Legend.background": "#f0f0f0",
562
+ "Box.color": "none",
563
+ "Colorbar.frame": False,
564
+ })
565
+
566
+ # -- The Economist (ggthemes theme_economist, base_size 10) -----------------------------
567
+
568
+ _EC_LINE = 0.5 * 72.27 / 25.4 * 0.75 # ggplot2 linewidth 0.5 mm
569
+
570
+ register_style("economist", {
571
+ "font_family": "Helvetica, Arial, Liberation Sans, sans-serif",
572
+ "font_size": 10.0,
573
+ "text_color": "black",
574
+ "line_width": _EC_LINE,
575
+ "palette": "economist",
576
+ "Figure.background": "#d5e4eb",
577
+ "Figure.title_rule": "#ed111a",
578
+ "Plot.background": "#d5e4eb",
579
+ "Plot.spines": "bottom",
580
+ "Title.font_size": 15.0,
581
+ "Title.font_weight": "bold",
582
+ "Title.align": "left",
583
+ "FigureTitle.font_size": 15.0,
584
+ "FigureTitle.align": "left",
585
+ "Axis.line_width": 0.8 * _EC_LINE,
586
+ "Axis.tick_direction": "in",
587
+ "Axis.tick_length": 5.0,
588
+ "Axis.tick_width": _EC_LINE,
589
+ "Axis.tick_pad": 5.0,
590
+ "YAxis.side": "right",
591
+ "YAxis.tick_length": 0.0,
592
+ "YAxis.grid": True,
593
+ "Axis.grid_color": "white",
594
+ "Axis.grid_width": 1.75 * _EC_LINE,
595
+ "Legend.position": "outside top",
596
+ "Legend.font_size": 12.5,
597
+ "Scatter.size": 4.3,
598
+ "Box.color": "#6794a7",
599
+ "Box.line_color": "black",
600
+ "Box.line_width": _EC_LINE,
601
+ "Box.cap_width": 0.0,
602
+ })
603
+
604
+ # -- Tufte (ggthemes theme_tufte, with a range frame) -----------------------------------
605
+
606
+ register_style("tufte", {
607
+ "font_family": "serif",
608
+ "font_size": 11.0,
609
+ "text_color": "black",
610
+ "line_width": 0.5,
611
+ "palette": "greys",
612
+ "color_map": "grey_r",
613
+ "Figure.background": "white",
614
+ "Title.font_size": 13.2,
615
+ "Title.align": "left",
616
+ "FigureTitle.font_weight": "normal",
617
+ "FigureTitle.align": "left",
618
+ "Axis.tick_size": 8.8,
619
+ "Axis.tick_label_color": "#4D4D4D",
620
+ "Axis.tick_color": "#333333",
621
+ "Axis.line_color": "#333333",
622
+ "Axis.line_width": 0.5,
623
+ "Axis.tick_length": 2.75,
624
+ "Axis.tick_width": 0.5,
625
+ "Axis.spine_trim": True,
626
+ "Axis.spine_offset": 5.0,
627
+ "Legend.position": "outside right",
628
+ "Scatter.size": 4.0,
629
+ "Box.color": "none",
630
+ "Box.line_color": "black",
631
+ "Box.line_width": 0.5,
632
+ "Box.width": 0.3,
633
+ "Box.cap_width": 0.0,
634
+ "Box.median_width": 0.5,
635
+ "Box.marker_color": "black",
636
+ "Box.marker_size": 2.0,
637
+ })
638
+
639
+
640
+ # -- the plot types of plan 3 ----------------------------------------------------------
641
+ # matplotlib and seaborn values read from the installed libraries' artists; the others from
642
+ # their documented defaults (sources in the plan's reference sheet).
643
+
644
+ def _extend(name: str, keys: dict) -> None:
645
+ from . import _STYLES
646
+ register_style(name, {**_STYLES[name], **keys})
647
+
648
+
649
+ _extend("matplotlib", {
650
+ "Kde.line_width": 1.5,
651
+ "Ecdf.line_width": 1.5,
652
+ "Violin.alpha": 0.3, # violinplot bodies: C0 at 0.3, no edge
653
+ "Violin.line_width": 0.0,
654
+ "Violin.inner": False,
655
+ "Strip.size": 6.0,
656
+ "Swarm.size": 6.0,
657
+ "Pie.line_width": 0.0, # wedges without edges
658
+ })
659
+ _extend("seaborn", {
660
+ "Bar.saturation": 0.75, # barplot: saturation .75, white 1 pt edges
661
+ "Bar.line_color": "white",
662
+ "Bar.line_width": 1.0,
663
+ "Bar.error_color": "#424242",
664
+ "Hist.alpha": 0.75, # histplot: alpha .75, white edges
665
+ "Hist.line_color": "white",
666
+ "Hist.line_width": 1.0,
667
+ "Kde.line_width": 1.5,
668
+ "Ecdf.line_width": 1.5,
669
+ "Violin.saturation": 0.75, # violinplot: edges and inner box #4c4c4c
670
+ "Violin.line_color": "#4c4c4c",
671
+ "Violin.line_width": 1.25,
672
+ "Strip.size": 5.0, # stripplot/swarmplot: s=25, no edge
673
+ "Strip.line_width": 0.0,
674
+ "Swarm.size": 5.0,
675
+ "Swarm.line_width": 0.0,
676
+ "Regression.line_width": 2.25, # regplot: lw 1.5 × 1.5, band alpha .15
677
+ "Regression.band_alpha": 0.15,
678
+ "Regression.marker_size": 6.0,
679
+ })
680
+ _extend("ggplot2", {
681
+ "Hist.line_width": 0.0,
682
+ "Kde.line_width": 1.067, # geom_density: black, linewidth 0.5
683
+ "Violin.color": "white", # geom_violin: white fill, grey20 outline
684
+ "Violin.line_color": "#333333",
685
+ "Violin.line_width": 1.067,
686
+ "Violin.inner": False,
687
+ "Regression.color": "#3366FF", # geom_smooth: #3366FF, linewidth 1
688
+ "Regression.line_width": 2.134,
689
+ "Regression.band_alpha": 0.4,
690
+ "Area.alpha": 1.0,
691
+ })
692
+ _extend("altair", {
693
+ "Bar.width": 0.9, # band scale paddingInner 0.1
694
+ "Hist.line_color": "white", # binSpacing 1 px
695
+ "Hist.line_width": 0.75,
696
+ "Area.alpha": 0.7,
697
+ "Pie.line_width": 0.0,
698
+ })
699
+ _extend("matlab", {
700
+ "Bar.line_color": "black", # bar: black 0.5 edges
701
+ "Bar.line_width": 0.5,
702
+ "Hist.alpha": 0.6, # histogram: FaceAlpha 0.6, black edges
703
+ "Hist.line_color": "black",
704
+ "Hist.line_width": 0.5,
705
+ "Pie.line_color": "black",
706
+ "Pie.line_width": 0.5,
707
+ })
708
+ _extend("chartjs", {
709
+ "Bar.width": 0.72, # categoryPercentage 0.8 × barPercentage 0.9
710
+ "Bar.alpha": 0.5, # default colors: background at 0.5
711
+ "Pie.line_width": 1.5, # 2 px white borders
712
+ })
713
+ _extend("plotly", {
714
+ "Bar.line_color": "#E5ECF6", # template: marker line #E5ECF6, 0.5 px
715
+ "Bar.line_width": 0.375,
716
+ "Hist.line_color": "#E5ECF6",
717
+ "Hist.line_width": 0.375,
718
+ "Pie.line_width": 0.0,
719
+ })
720
+ _extend("excel", {
721
+ "Bar.width": 0.48, # gap width 219 % (two series: 2 / 4.19)
722
+ "Pie.line_color": "white",
723
+ "Pie.line_width": 0.75,
724
+ })
725
+ _extend("fivethirtyeight", {
726
+ "Bar.line_color": "#f0f0f0", # patch.edgecolor #f0f0f0, linewidth 0.5
727
+ "Bar.line_width": 0.5,
728
+ "Hist.line_color": "#f0f0f0",
729
+ "Hist.line_width": 0.5,
730
+ "Pie.line_color": "#f0f0f0",
731
+ "Pie.line_width": 0.5,
732
+ })