Core Concepts

/

Configuration

Configuration

XY's declarative chart API keeps configuration local to a chart. It has no public mutable global-settings object: compose configuration components or pass props where the behavior is used. This keeps notebooks, exports, and multiple charts in one process from changing one another implicitly. The separate xy.pyplot compatibility API retains Matplotlib-style mutable settings.

Configuration stays local

The same data can use defaults in one chart and a chart-local theme, interaction policy, axes, and layout in another:

The second chart's dark theme, fixed domains, crosshair, and drag-to-select behavior do not change the first chart.

SurfaceConfigure withScope
Dimensions and layoutwidth, height, padding, titleOne chart
Data defaultdata= on the chartMarks without their own data=
Scales and ticksx_axis(), y_axis()One named axis
Browser behaviorinteraction_config() or chart flagsOne chart
Theme tokenstheme() and chart style=One chart and descendants
DOM chromeclass_names= and styles=Stable slots in one chart
Rendered marksMark props and mark style=One mark
Export defaultsexport_config()One chart
Export overrideto_image(), write_image() argumentsOne export call

Chart dimensions default to 900×420 pixels. width="100%" fills the parent; height="100%" also needs a parent with a defined height. Fixed dimensions are preferable for deterministic static output and facet layouts.

Configure export defaults

export_config() describes download and Python-export defaults without writing a file at chart construction time. Hover the chart, then open its Export menu to see the configured PNG, SVG, and CSV options:

export_with_browser_css() is a per-call override for cases that require browser fonts, author CSS, or WebGL screenshot fidelity. Ordinary export_chart.write_image("weekly-signups.png") remains browser-free, uses the native engine, and inherits the chart's configured dimensions and background.

Set the XY_BROWSER environment variable to a Chrome/Chromium/Edge executable when browser discovery should not use the platform defaults. custom_css is valid for standalone HTML and Chromium-backed PNG, JPEG, WebP, and PDF exports. SVG is native-only.

Engine thresholds are policy, not public configuration

Automatic decimation, density, sampling, and pyramid constants live in an internal engine module so the Python kernel and interaction paths agree. They are observable through tier metadata and described in Large data and performance, but importing or monkey-patching those constants is not a supported global configuration API. The thresholds may change as the alpha is tuned.

Use Themes and tokens for reusable visual defaults and host-framework state for application-wide reactive settings.

Built with Reflex