plot3 0.4.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.
plot3/themes.py ADDED
@@ -0,0 +1,104 @@
1
+ """Palettes and theme tokens."""
2
+
3
+ from __future__ import annotations
4
+
5
+ # Validated: light on #fcfcfb, dark on #0b1020 — dataviz reference
6
+ _CAT_LIGHT = ["#2a78d6", "#1baf7a", "#eda100", "#008300",
7
+ "#4a3aa7", "#e34948", "#e87ba4", "#eb6834"]
8
+ _CAT_DARK = ["#3987e5", "#199e70", "#c98500", "#008300",
9
+ "#9085e9", "#e66767", "#d55181", "#d95926"]
10
+ # Sequential blue ramp, steps 100..700 (light -> dark). Light mode uses it as
11
+ # given (low=light); dark mode reversed so "near zero" recedes to the surface.
12
+ _SEQ = ["#cde2fb", "#b7d3f6", "#9ec5f4", "#86b6ef", "#6da7ec", "#5598e7",
13
+ "#3987e5", "#2a78d6", "#256abf", "#1c5cab", "#184f95", "#104281",
14
+ "#0d366b"]
15
+
16
+ # Perceptually-ordered scientific colormaps (exact matplotlib 16-stop hex) —
17
+ # multi-hue but monotonic in lightness, CVD-safe; the lidar/heatmap choice.
18
+ # Same stops in both themes (standard practice for viridis-family maps).
19
+ _VIRIDIS = ["#440154", "#481a6c", "#472f7d", "#414487", "#39568c", "#31688e",
20
+ "#2a788e", "#23888e", "#1f988b", "#22a884", "#35b779", "#54c568",
21
+ "#7ad151", "#a5db36", "#d2e21b", "#fde725"]
22
+ _MAGMA = ["#000004", "#0b0924", "#20114b", "#3b0f70", "#57157e", "#721f81",
23
+ "#8c2981", "#a8327d", "#c43c75", "#de4968", "#f1605d", "#fa7f5e",
24
+ "#fe9f6d", "#febf84", "#fddea0", "#fcfdbf"]
25
+ _TURBO = ["#30123b", "#4143a7", "#4771e9", "#3e9bfe", "#22c5e2", "#1ae4b6",
26
+ "#46f884", "#88ff4e", "#b9f635", "#e1dd37", "#faba39", "#fd8d27",
27
+ "#f05b12", "#d63506", "#af1801", "#7a0403"]
28
+ # Driving-scene height colours: bright green ground, cyan objects, violet
29
+ # and pink for the tallest. Every stop stays visible on black.
30
+ _LIDAR = ["#22b14c", "#2fd35a", "#3fe28a", "#3fe6c8", "#41c8f0", "#5aa0ff",
31
+ "#8a86ff", "#b07cff", "#e07ce8", "#ff7ad9"]
32
+ _CONT_PALETTES = {"viridis": _VIRIDIS, "magma": _MAGMA, "turbo": _TURBO, "lidar": _LIDAR}
33
+ # Class colours that read on black, for boxes around detected objects.
34
+ _CAT_LIDAR = ["#ff8a80", "#ffffff", "#b39ddb", "#80deea", "#ffe57f",
35
+ "#a5d6a7", "#f48fb1", "#90caf9"]
36
+
37
+ # frame is how static export draws the panel: "box" (full rectangle),
38
+ # "axes" (left and bottom only), or "none". The viewer ignores it and
39
+ # strokes T.axis around the panel, so a white axis colour hides that box.
40
+ _THEMES = {
41
+ "light": dict(
42
+ surface="#fcfcfb", ink="#0b0b0b", ink2="#52514e", muted="#898781",
43
+ grid="#e1e0d9", axis="#c3c2b7", cat=_CAT_LIGHT, seq=_SEQ,
44
+ frame="box",
45
+ ),
46
+ "dark": dict(
47
+ surface="#0b1020", ink="#ffffff", ink2="#c3c2b7", muted="#898781",
48
+ grid="#1c2742", axis="#2e3a5c", cat=_CAT_DARK,
49
+ seq=list(reversed(_SEQ)),
50
+ frame="box",
51
+ ),
52
+ # ggplot2 theme_bw: white page, grey major grid, dark panel border.
53
+ "bw": dict(
54
+ surface="#ffffff", ink="#000000", ink2="#222222", muted="#4d4d4d",
55
+ grid="#ebebeb", axis="#333333", cat=_CAT_LIGHT, seq=_SEQ,
56
+ frame="box",
57
+ ),
58
+ # ggplot2 theme_classic: white page, no grid, black axis lines.
59
+ "classic": dict(
60
+ surface="#ffffff", ink="#000000", ink2="#000000", muted="#4d4d4d",
61
+ grid="#ffffff", axis="#000000", cat=_CAT_LIGHT, seq=_SEQ,
62
+ frame="axes",
63
+ ),
64
+ # A driving scene: black page, the data alone, height colours that
65
+ # stay bright on black. void hides the 3D box, grid, and tick labels.
66
+ "lidar": dict(
67
+ surface="#000000", ink="#ffffff", ink2="#c3c2b7", muted="#898781",
68
+ grid="#000000", axis="#000000", cat=_CAT_LIDAR, seq=_LIDAR,
69
+ frame="none", void=True, ramp3d="lidar",
70
+ ),
71
+ # ggplot2 theme_void: the data alone, no axes, ticks, grid, or box.
72
+ "void": dict(
73
+ surface="#ffffff", ink="#000000", ink2="#222222", muted="#4d4d4d",
74
+ grid="#ffffff", axis="#ffffff", cat=_CAT_LIGHT, seq=_SEQ,
75
+ frame="none", void=True,
76
+ ),
77
+ # ggplot2's default theme_grey: a grey panel with white grid lines.
78
+ "grey": dict(
79
+ surface="#ffffff", panel="#ebebeb", ink="#000000", ink2="#000000",
80
+ muted="#4d4d4d", grid="#ffffff", axis="#ebebeb", cat=_CAT_LIGHT, seq=_SEQ,
81
+ frame="none",
82
+ ),
83
+ # ggplot2 theme_linedraw: white panel, thin dark grid, black border.
84
+ "linedraw": dict(
85
+ surface="#ffffff", ink="#000000", ink2="#000000", muted="#000000",
86
+ grid="#c7c7c7", axis="#000000", cat=_CAT_LIGHT, seq=_SEQ, frame="box",
87
+ ),
88
+ # ggplot2 theme_minimal: white page, light grid, no axis box.
89
+ "minimal": dict(
90
+ surface="#ffffff", ink="#000000", ink2="#222222", muted="#4d4d4d",
91
+ grid="#ebebeb", axis="#ffffff", cat=_CAT_LIGHT, seq=_SEQ,
92
+ frame="none",
93
+ ),
94
+ }
95
+
96
+ # What a layer with no colour of its own is drawn in. ggplot2 draws points,
97
+ # lines, and outlines black and bars grey35; the dark viewer theme keeps
98
+ # its own blue, which black would not show on.
99
+ for _name, _theme in _THEMES.items():
100
+ _light = _theme["surface"].lower() not in {"#0b1020", "#000000"}
101
+ _theme.setdefault("mark", "#000000" if _light else ("#ffffff" if _name == "lidar" else _theme["cat"][0]))
102
+ _theme.setdefault("bar", "#595959" if _light else _theme["cat"][0])
103
+
104
+