xy 0.0.2__py3-none-win_amd64.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.
- xy/__init__.py +325 -0
- xy/_annotations.py +598 -0
- xy/_arrowgeom.py +210 -0
- xy/_chromium.py +436 -0
- xy/_figure.py +1889 -0
- xy/_framing.py +306 -0
- xy/_hosts.py +68 -0
- xy/_jpeg.py +382 -0
- xy/_native.py +3258 -0
- xy/_native_lib/xy_core.dll +0 -0
- xy/_ooc.py +150 -0
- xy/_paint.py +85 -0
- xy/_payload.py +1140 -0
- xy/_pdf.py +1262 -0
- xy/_png.py +86 -0
- xy/_raster.py +2177 -0
- xy/_scene.py +107 -0
- xy/_spatial.py +118 -0
- xy/_svg.py +3000 -0
- xy/_trace.py +147 -0
- xy/_typing.py +57 -0
- xy/_validate.py +502 -0
- xy/_webp.py +322 -0
- xy/channel.py +411 -0
- xy/channels.py +811 -0
- xy/columns.py +610 -0
- xy/components.py +5197 -0
- xy/config.py +174 -0
- xy/dom.py +40 -0
- xy/export.py +1139 -0
- xy/facets.py +485 -0
- xy/interaction.py +1398 -0
- xy/kernels.py +155 -0
- xy/lod.py +991 -0
- xy/marks.py +2485 -0
- xy/py.typed +0 -0
- xy/pyplot/__init__.py +3093 -0
- xy/pyplot/_artists.py +1175 -0
- xy/pyplot/_axes.py +5325 -0
- xy/pyplot/_axisgrid.py +301 -0
- xy/pyplot/_colors.py +397 -0
- xy/pyplot/_fmt.py +52 -0
- xy/pyplot/_grid.py +345 -0
- xy/pyplot/_mathtext.py +150 -0
- xy/pyplot/_mplfig.py +1273 -0
- xy/pyplot/_plot_types.py +4709 -0
- xy/pyplot/_rc.py +190 -0
- xy/pyplot/_state.py +155 -0
- xy/pyplot/_ticker.py +276 -0
- xy/pyplot/_transforms.py +111 -0
- xy/pyplot/_translate.py +141 -0
- xy/pyplot/dates.py +188 -0
- xy/static/index.js +853 -0
- xy/static/standalone.js +853 -0
- xy/styles.py +379 -0
- xy/widget.py +192 -0
- xy-0.0.2.dist-info/METADATA +239 -0
- xy-0.0.2.dist-info/RECORD +60 -0
- xy-0.0.2.dist-info/WHEEL +4 -0
- xy-0.0.2.dist-info/licenses/LICENSE +202 -0
xy/__init__.py
ADDED
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
"""xy — an experimental Python charting engine.
|
|
2
|
+
|
|
3
|
+
Cost scales with pixels on screen, not points in the dataset: native Rust core
|
|
4
|
+
in the Python process, offset-encoded f32 binary transport, M4 decimation, GPU
|
|
5
|
+
density aggregation, and a WebGL2 render client. See spec/design-dossier.md.
|
|
6
|
+
|
|
7
|
+
One declarative API over one engine — Reflex-flavored composition with
|
|
8
|
+
`on_*` event props:
|
|
9
|
+
|
|
10
|
+
import xy
|
|
11
|
+
xy.scatter_chart(
|
|
12
|
+
xy.scatter(x="gdp", y="life", color="continent", size="pop", data=df),
|
|
13
|
+
xy.x_axis(label="GDP"), xy.y_axis(label="life expectancy"),
|
|
14
|
+
xy.legend(),
|
|
15
|
+
on_select=lambda sel: print(len(sel), "points"),
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
Import does no heavy work (§33 import-time budget). Public symbols below are
|
|
19
|
+
exported lazily so `import xy` does not import NumPy or dlopen the
|
|
20
|
+
native core; those initialize when a chart-building API is first imported/used.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
from __future__ import annotations
|
|
24
|
+
|
|
25
|
+
from importlib import import_module
|
|
26
|
+
from typing import TYPE_CHECKING, Any
|
|
27
|
+
|
|
28
|
+
_EXPORTS = {
|
|
29
|
+
"Annotation": ".components",
|
|
30
|
+
"Animation": ".components",
|
|
31
|
+
"Axis": ".components",
|
|
32
|
+
"CHART_DOM_SLOTS": ".dom",
|
|
33
|
+
"Chart": ".components",
|
|
34
|
+
"Colorbar": ".components",
|
|
35
|
+
"Column": ".columns",
|
|
36
|
+
"ColumnStore": ".columns",
|
|
37
|
+
"Component": ".components",
|
|
38
|
+
"Engine": ".export",
|
|
39
|
+
"ExportConfig": ".components",
|
|
40
|
+
"FacetChart": ".components",
|
|
41
|
+
"Interaction": ".components",
|
|
42
|
+
"Legend": ".components",
|
|
43
|
+
"Mark": ".components",
|
|
44
|
+
"Modebar": ".components",
|
|
45
|
+
"Selection": "._figure",
|
|
46
|
+
"Spring": ".components",
|
|
47
|
+
"Theme": ".components",
|
|
48
|
+
"Tooltip": ".components",
|
|
49
|
+
"ZoneMaps": ".columns",
|
|
50
|
+
"area": ".components",
|
|
51
|
+
"animation": ".components",
|
|
52
|
+
"area_chart": ".components",
|
|
53
|
+
"arrow": ".components",
|
|
54
|
+
"bar": ".components",
|
|
55
|
+
"bar_chart": ".components",
|
|
56
|
+
"box": ".components",
|
|
57
|
+
"box_chart": ".components",
|
|
58
|
+
"callout": ".components",
|
|
59
|
+
"chart": ".components",
|
|
60
|
+
"column": ".components",
|
|
61
|
+
"column_chart": ".components",
|
|
62
|
+
"colorbar": ".components",
|
|
63
|
+
"contour": ".components",
|
|
64
|
+
"contour_chart": ".components",
|
|
65
|
+
"ecdf": ".components",
|
|
66
|
+
"ecdf_chart": ".components",
|
|
67
|
+
"facet_chart": ".components",
|
|
68
|
+
"error_band": ".components",
|
|
69
|
+
"error_band_chart": ".components",
|
|
70
|
+
"errorbar": ".components",
|
|
71
|
+
"errorbar_chart": ".components",
|
|
72
|
+
"export_config": ".components",
|
|
73
|
+
"hexbin": ".components",
|
|
74
|
+
"hexbin_chart": ".components",
|
|
75
|
+
"heatmap": ".components",
|
|
76
|
+
"heatmap_chart": ".components",
|
|
77
|
+
"hline": ".components",
|
|
78
|
+
"hist": ".components",
|
|
79
|
+
"histogram": ".components",
|
|
80
|
+
"histogram_chart": ".components",
|
|
81
|
+
"interaction_config": ".components",
|
|
82
|
+
"label": ".components",
|
|
83
|
+
"legend": ".components",
|
|
84
|
+
"line": ".components",
|
|
85
|
+
"line_chart": ".components",
|
|
86
|
+
"marker": ".components",
|
|
87
|
+
"modebar": ".components",
|
|
88
|
+
"scatter": ".components",
|
|
89
|
+
"scatter_chart": ".components",
|
|
90
|
+
"segments": ".components",
|
|
91
|
+
"segments_chart": ".components",
|
|
92
|
+
"step": ".components",
|
|
93
|
+
"step_chart": ".components",
|
|
94
|
+
"stairs": ".components",
|
|
95
|
+
"stairs_chart": ".components",
|
|
96
|
+
"stem": ".components",
|
|
97
|
+
"stem_chart": ".components",
|
|
98
|
+
"spring": ".components",
|
|
99
|
+
"threshold": ".components",
|
|
100
|
+
"threshold_zone": ".components",
|
|
101
|
+
"triangle_mesh": ".components",
|
|
102
|
+
"triangle_mesh_chart": ".components",
|
|
103
|
+
"theme": ".components",
|
|
104
|
+
"tooltip": ".components",
|
|
105
|
+
"text": ".components",
|
|
106
|
+
"vline": ".components",
|
|
107
|
+
"x_band": ".components",
|
|
108
|
+
"write_images": ".export",
|
|
109
|
+
"x_axis": ".components",
|
|
110
|
+
"y_band": ".components",
|
|
111
|
+
"y_axis": ".components",
|
|
112
|
+
"violin": ".components",
|
|
113
|
+
"violin_chart": ".components",
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
__all__ = [
|
|
117
|
+
"CHART_DOM_SLOTS",
|
|
118
|
+
"Animation",
|
|
119
|
+
"Annotation",
|
|
120
|
+
"Axis",
|
|
121
|
+
"Chart",
|
|
122
|
+
"Colorbar",
|
|
123
|
+
"Column",
|
|
124
|
+
"ColumnStore",
|
|
125
|
+
"Component",
|
|
126
|
+
"Engine",
|
|
127
|
+
"ExportConfig",
|
|
128
|
+
"FacetChart",
|
|
129
|
+
"Interaction",
|
|
130
|
+
"Legend",
|
|
131
|
+
"Mark",
|
|
132
|
+
"Modebar",
|
|
133
|
+
"Selection",
|
|
134
|
+
"Spring",
|
|
135
|
+
"Theme",
|
|
136
|
+
"Tooltip",
|
|
137
|
+
"ZoneMaps",
|
|
138
|
+
"__version__",
|
|
139
|
+
"animation",
|
|
140
|
+
"area",
|
|
141
|
+
"area_chart",
|
|
142
|
+
"arrow",
|
|
143
|
+
"bar",
|
|
144
|
+
"bar_chart",
|
|
145
|
+
"box",
|
|
146
|
+
"box_chart",
|
|
147
|
+
"callout",
|
|
148
|
+
"chart",
|
|
149
|
+
"colorbar",
|
|
150
|
+
"column",
|
|
151
|
+
"column_chart",
|
|
152
|
+
"contour",
|
|
153
|
+
"contour_chart",
|
|
154
|
+
"ecdf",
|
|
155
|
+
"ecdf_chart",
|
|
156
|
+
"error_band",
|
|
157
|
+
"error_band_chart",
|
|
158
|
+
"errorbar",
|
|
159
|
+
"errorbar_chart",
|
|
160
|
+
"export_config",
|
|
161
|
+
"facet_chart",
|
|
162
|
+
"heatmap",
|
|
163
|
+
"heatmap_chart",
|
|
164
|
+
"hexbin",
|
|
165
|
+
"hexbin_chart",
|
|
166
|
+
"hist",
|
|
167
|
+
"histogram",
|
|
168
|
+
"histogram_chart",
|
|
169
|
+
"hline",
|
|
170
|
+
"interaction_config",
|
|
171
|
+
"label",
|
|
172
|
+
"legend",
|
|
173
|
+
"line",
|
|
174
|
+
"line_chart",
|
|
175
|
+
"marker",
|
|
176
|
+
"modebar",
|
|
177
|
+
"scatter",
|
|
178
|
+
"scatter_chart",
|
|
179
|
+
"segments",
|
|
180
|
+
"segments_chart",
|
|
181
|
+
"spring",
|
|
182
|
+
"stairs",
|
|
183
|
+
"stairs_chart",
|
|
184
|
+
"stem",
|
|
185
|
+
"stem_chart",
|
|
186
|
+
"step",
|
|
187
|
+
"step_chart",
|
|
188
|
+
"text",
|
|
189
|
+
"theme",
|
|
190
|
+
"threshold",
|
|
191
|
+
"threshold_zone",
|
|
192
|
+
"tooltip",
|
|
193
|
+
"triangle_mesh",
|
|
194
|
+
"triangle_mesh_chart",
|
|
195
|
+
"violin",
|
|
196
|
+
"violin_chart",
|
|
197
|
+
"vline",
|
|
198
|
+
"write_images",
|
|
199
|
+
"x_axis",
|
|
200
|
+
"x_band",
|
|
201
|
+
"y_axis",
|
|
202
|
+
"y_band",
|
|
203
|
+
]
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
def _load_export(name: str) -> Any:
|
|
207
|
+
module_name = _EXPORTS.get(name)
|
|
208
|
+
if module_name is None:
|
|
209
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
210
|
+
value = getattr(import_module(module_name, __name__), name)
|
|
211
|
+
globals()[name] = value
|
|
212
|
+
return value
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
def _load_version() -> str:
|
|
216
|
+
"""Resolve the installed distribution's version.
|
|
217
|
+
|
|
218
|
+
The version is not written down in the source tree at all — it is derived
|
|
219
|
+
from the `v*` git tag at build time (pyproject's uv-dynamic-versioning
|
|
220
|
+
config) and baked into the wheel's METADATA, so package metadata is the
|
|
221
|
+
only place that can answer this at runtime.
|
|
222
|
+
|
|
223
|
+
Resolved lazily, like every other export: `importlib.metadata` costs tens
|
|
224
|
+
of milliseconds against a 200 ms `import xy` budget (§33), which is a poor
|
|
225
|
+
trade for a string most callers never read. A source tree that was never
|
|
226
|
+
installed has no metadata to read, and reports the same unreal `0.0.0` the
|
|
227
|
+
build-time fallback uses.
|
|
228
|
+
"""
|
|
229
|
+
from importlib.metadata import PackageNotFoundError
|
|
230
|
+
from importlib.metadata import version as _distribution_version
|
|
231
|
+
|
|
232
|
+
try:
|
|
233
|
+
return _distribution_version("xy")
|
|
234
|
+
except PackageNotFoundError:
|
|
235
|
+
return "0.0.0"
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
def __getattr__(name: str) -> Any:
|
|
239
|
+
if name == "__version__":
|
|
240
|
+
value = _load_version()
|
|
241
|
+
globals()["__version__"] = value
|
|
242
|
+
return value
|
|
243
|
+
return _load_export(name)
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
def __dir__() -> list[str]:
|
|
247
|
+
return sorted(set(globals()) | set(__all__))
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
if TYPE_CHECKING:
|
|
251
|
+
from ._figure import Selection
|
|
252
|
+
from .columns import Column, ColumnStore, ZoneMaps
|
|
253
|
+
from .components import (
|
|
254
|
+
Annotation,
|
|
255
|
+
Axis,
|
|
256
|
+
Chart,
|
|
257
|
+
Colorbar,
|
|
258
|
+
Component,
|
|
259
|
+
FacetChart,
|
|
260
|
+
Interaction,
|
|
261
|
+
Legend,
|
|
262
|
+
Mark,
|
|
263
|
+
Modebar,
|
|
264
|
+
Theme,
|
|
265
|
+
Tooltip,
|
|
266
|
+
area,
|
|
267
|
+
area_chart,
|
|
268
|
+
arrow,
|
|
269
|
+
bar,
|
|
270
|
+
bar_chart,
|
|
271
|
+
box,
|
|
272
|
+
box_chart,
|
|
273
|
+
callout,
|
|
274
|
+
chart,
|
|
275
|
+
colorbar,
|
|
276
|
+
column,
|
|
277
|
+
column_chart,
|
|
278
|
+
contour,
|
|
279
|
+
contour_chart,
|
|
280
|
+
ecdf,
|
|
281
|
+
ecdf_chart,
|
|
282
|
+
error_band,
|
|
283
|
+
error_band_chart,
|
|
284
|
+
errorbar,
|
|
285
|
+
errorbar_chart,
|
|
286
|
+
export_config,
|
|
287
|
+
facet_chart,
|
|
288
|
+
heatmap,
|
|
289
|
+
heatmap_chart,
|
|
290
|
+
hexbin,
|
|
291
|
+
hexbin_chart,
|
|
292
|
+
hist,
|
|
293
|
+
histogram,
|
|
294
|
+
histogram_chart,
|
|
295
|
+
hline,
|
|
296
|
+
interaction_config,
|
|
297
|
+
label,
|
|
298
|
+
legend,
|
|
299
|
+
line,
|
|
300
|
+
line_chart,
|
|
301
|
+
marker,
|
|
302
|
+
modebar,
|
|
303
|
+
scatter,
|
|
304
|
+
scatter_chart,
|
|
305
|
+
stairs,
|
|
306
|
+
stairs_chart,
|
|
307
|
+
stem,
|
|
308
|
+
stem_chart,
|
|
309
|
+
step,
|
|
310
|
+
step_chart,
|
|
311
|
+
text,
|
|
312
|
+
theme,
|
|
313
|
+
threshold,
|
|
314
|
+
threshold_zone,
|
|
315
|
+
tooltip,
|
|
316
|
+
violin,
|
|
317
|
+
violin_chart,
|
|
318
|
+
vline,
|
|
319
|
+
x_axis,
|
|
320
|
+
x_band,
|
|
321
|
+
y_axis,
|
|
322
|
+
y_band,
|
|
323
|
+
)
|
|
324
|
+
from .dom import CHART_DOM_SLOTS
|
|
325
|
+
from .export import Engine, write_images
|