XY is an highly fast, interactive, customizable Python charting room for the web, notebooks, and fixed exports.
Charts are composed declaratively aliases done matplotlib conventions. You can fully customize them pinch Python, CSS, aliases Tailwind.
With mini charts, each constituent is sent to the browser. For ample charts, the Rust halfway computes only what the surface needs to display, based connected its resolution. Pan, zoom, hover, and action tin show afloat specifications by moving the same process for the caller range, and a action returns the original rows.
With XY we rendered the entirety of OpenStreetMap — a 10,000,000,000 point dataset. See the illustration →
Important
XY is successful alpha and is receiving predominant enhancements. ⭐️ Star the repo to travel the progress.
XY is for Python users who want 1 elastic charting room for everything from mundane land to civilization exertion visuals and ample datasets. Build a chart once, past usage it successful notebooks and web apps aliases export it arsenic HTML, PNG, SVG, aliases PDF.
A floor plan is simply a instrumentality positive the marks wrong it. Any series works; NumPy is optional.
The aforesaid API scales to a 100 cardinal points arsenic a density surface:
For communal pyplot workflows, alteration the import and support the plotting code:
See the compatibility guide; not each charts and functionality are supported yet.
Use Python to power the chart, from marks and axes to interactions and layout.
- Marks: Control color, size, opacity, symbols, gradients, strokes, curves, and colormaps.
- Guides: Customize axes, ticks, grids, annotations, legends, colorbars, and tooltips.
- Interaction: Add pan, zoom, hover, selections, crosshairs, callbacks, and linked charts.
- Layout: Create layers and facets, group responsive dimensions, and apply themes.
See the styling guide for examples. For a elaborate breakdown of what tin beryllium customized, spot the capability matrix.
Live interactive charts, 10k to 100M points. Every room gets each statement and is driven done its ain input way successful a existent browser. The timepiece stops only when the canvas is some correct (planted sentinel points verified lit) and stable (10 byte-identical frames), truthful progressive renderers are charged until their past chunk lands.
XY holds 0.071 s astatine 10k and 0.081 s astatine 100M, level crossed 4 orders of magnitude, because supra 200k rows it draws a screen-bounded density surface instead of 1 marker per row, and zoom drills backmost to nonstop rows. Every exact-marker way scales pinch N instead: Matplotlib crosses a 2nd astatine ~3M and reaches 13.4 s astatine 50M; Plotly crosses astatine ~2.5M and reaches 9.8 s astatine 25M.
The ray statement is XY pinch density=False: the aforesaid motor drafting 1 marker per row, nary aggregation credit. It renders 100M nonstop markers successful 1.34 s on 5.26 GiB.
Time until each constituent is connected screen, successful seconds. ✕ is simply a size the library did not render: Plotly ne'er finishes constructing the fig astatine 50M, and Matplotlib draws astatine 100M but ne'er resolves the zoom that follows.
| XY speedup | 1× | 2× | 3× | 4× | 9× | 16× | 34× | 89× | 177× | — |
| XY | 0.071 | 0.072 | 0.075 | 0.084 | 0.083 | 0.089 | 0.083 | 0.077 | 0.076 | 0.081 |
| XY (density=False) | 0.085 | 0.074 | 0.087 | 0.098 | 0.111 | 0.144 | 0.206 | 0.424 | 0.645 | 1.343 |
| Matplotlib (WebAgg) | 0.086 | 0.115 | 0.224 | 0.357 | 0.758 | 1.424 | 2.804 | 6.838 | 13.385 | ✕ |
| Plotly (scattergl) | 0.341 | 0.373 | 0.477 | 0.614 | 1.033 | 1.785 | 3.367 | 9.794 | ✕ | ✕ |
Peak Python-side resident memory, successful GiB. Browser representation is tracked separately and excluded here, since a headless Chrome resides ~1 GiB earlier drawing anything.
| XY advantage | 1.8× | 1.7× | 1.9× | 2.1× | 2.1× | 2.4× | 2.6× | 2.9× | 2.8× | — |
| XY | 0.05 | 0.05 | 0.06 | 0.07 | 0.13 | 0.19 | 0.32 | 0.70 | 1.36 | 2.58 |
| XY (density=False) | 0.05 | 0.05 | 0.07 | 0.10 | 0.18 | 0.31 | 0.57 | 1.35 | 2.66 | 5.26 |
| Matplotlib (WebAgg) | 0.09 | 0.09 | 0.12 | 0.15 | 0.28 | 0.46 | 0.84 | 2.06 | 3.85 | ✕ |
| Plotly (scattergl) | 0.21 | 0.18 | 0.28 | 0.36 | 0.60 | 1.05 | 1.86 | 4.70 | ✕ | ✕ |
One instrumentality (Apple M5 Pro), 1 tally per cell; astatine the mini extremity the timings carry astir ±10 sclerosis of run-to-run spread.
For the environment, methodology, per-size videos, and earthy results, spot the benchmark runbook and competitive benchmark specification.
The reflex-xy adapter turns immoderate XY floor plan into a regular Reflex component, with no JavaScript, iframe, aliases abstracted floor plan service. It ships arsenic its ain package and pulls successful xy and reflex:
Register the adapter once:
Then adhd a floor plan anyplace successful the constituent tree:
Hover, pan, and zoom support working. For charts driven by Reflex state, events, or live streams, spot the Reflex integration guide and the runnable illustration app.
Each notebook fetches its rows from the linked nationalist source; nary earthy datasets are stored successful this repository. Counts picture the featured chart, and the notebooks standard further. See the example guide for sources, workload controls, and setup.
Most floor plan stacks serialize each worth arsenic JSON and inquire the browser to draw every mark. XY keeps nonstop values successful a ColumnStore, computes a level of detail in Rust, and transfers typed binary buffers. Decimated and density views are bounded by the visible result.
So a dense overview tin aggregate while a constrictive position returns nonstop points. With a unrecorded host, cookware and zoom petition a refined payload. Canonical f64 information stays in Python, truthful hover and action still return original rows.
For the afloat design, spot the design dossier.
Broad 2D sum first, past geographic, 3D, and measurement visualization. Queued next, nary dates implied:
- Categorical distributions: strip, swarm, beeswarm, boxen, rug
- Regression diagnostics: trendline, residual, QQ, PP
- Scatter matrix and associated plots: SPLOM, brace grid, marginal histograms
- Pie / donut: successful xy.pyplot today, promoting to xy.pie_chart(xy.pie(...))
- Candlestick / OHLC and finance overlays: SMA, VWAP, Bollinger, RSI, MACD; prototyped, awaiting a caller landing
- Waterfall and funnel
- Treemap, sunburst, and icicle
- Radar / polar and gauge: needs polar axes first
- Slope, bump, and dumbbell
- 3D and volume: scatter, surfaces, meshes, isosurfaces, and volumetric views
The afloat classed backlog is successful the chart roadmap. Want a floor plan aliases characteristic that isn't listed? Open an issue.
English (US) ·
Indonesian (ID) ·