|
def to_image( |
|
self, |
|
format: str = "png", |
|
*, |
|
width: Optional[int] = None, |
|
height: Optional[int] = None, |
|
scale: Optional[float] = None, |
|
background: Optional[str] = None, |
|
engine: export.Engine | str = export.Engine.auto, |
|
quality: Optional[int] = None, |
|
optimize: bool = False, |
|
custom_css: Optional[str] = None, |
|
sandbox: bool = True, |
|
gl: str = "software", |
|
) -> bytes: |
|
"""Unified static export: PNG/JPEG/WebP/SVG/PDF bytes. |
|
|
|
Omitted width/height/scale/background/quality fall back to the |
|
chart's `export_config` defaults; explicit arguments override them. |
|
See `export.to_image` for the full format/engine/background policy.""" |
|
fmt = export._normalize_format(format) |
|
resolved = export._resolve_image_engine(engine, fmt, custom_css) |
|
return self.figure().to_image( |
|
format, |
|
engine=engine, |
|
optimize=optimize, |
|
custom_css=custom_css, |
|
sandbox=sandbox, |
|
gl=gl, |
|
**self._export_defaults( |
|
fmt, |
|
width, |
|
height, |
|
scale, |
|
background, |
|
quality, |
|
lossy_webp=resolved == "browser", |
|
), |
|
) |
|
|
|
def write_image( |
|
self, |
|
path: str | PathLike[str], |
|
*, |
|
format: Optional[str] = None, |
|
width: Optional[int] = None, |
|
height: Optional[int] = None, |
|
scale: Optional[float] = None, |
|
background: Optional[str] = None, |
|
engine: export.Engine | str = export.Engine.auto, |
|
quality: Optional[int] = None, |
|
optimize: bool = False, |
|
custom_css: Optional[str] = None, |
|
sandbox: bool = True, |
|
gl: str = "software", |
|
) -> bytes: |
|
"""Atomic file export with extension-inferred format (.png/.jpg/ |
|
.jpeg/.webp/.svg/.pdf/.html). `export_config` defaults apply as in |
|
`to_image`; explicit arguments override them.""" |
Summary
XY's public surface has outgrown both its API-reference prose and its stability checks. The hard-coded declarative inventory validates only a subset of shipped marks/factories and omits newer
Chartmethods; the type-surface test duplicates that stale list. Separately,make check-docsis an alias ofmake check-examples, so the documented local docs gate does not run the docs app or docs quickstart at all.Evidence
verify_local.py --only examples:xy/Makefile
Lines 76 to 80 in 99eda6d
verify_docs_quickstart.py, while that script itself executes onlyfirst-chart.md:xy/.github/workflows/docs.yml
Lines 63 to 68 in 99eda6d
xy/scripts/verify_docs_quickstart.py
Lines 16 to 20 in 99eda6d
components.__all__exposes the broader component surface:xy/python/xy/components.py
Lines 64 to 155 in 99eda6d
check_public_api.pymanually lists only a subset and validates only those names/methods:xy/scripts/check_public_api.py
Lines 49 to 115 in 99eda6d
xy/scripts/check_public_api.py
Lines 262 to 288 in 99eda6d
Charthasset_view,reset_view,select,clear_selection,view_state,to_image, andwrite_image:xy/python/xy/components.py
Lines 4100 to 4128 in 99eda6d
xy/python/xy/components.py
Lines 4246 to 4304 in 99eda6d
xy/docs/api-reference/figure-methods.md
Lines 90 to 105 in 99eda6d
Selection.rows()ships but is absent from the documentedSelectionlist:xy/python/xy/_figure.py
Lines 72 to 87 in 99eda6d
xy/docs/api-reference/events-and-callbacks.md
Lines 44 to 55 in 99eda6d
Acceptance criteria
Chartview/export methods andSelection.rows().make check-docsrun the checkout-backed docs tests/quickstarts it advertises; keepcheck-examplesseparate.