Skip to content

Axis tick-label anchoring, figure-background theming, and rule-label styling#75

Open
FarhanAliRaza wants to merge 3 commits into
mainfrom
advanced-demo-styling
Open

Axis tick-label anchoring, figure-background theming, and rule-label styling#75
FarhanAliRaza wants to merge 3 commits into
mainfrom
advanced-demo-styling

Conversation

@FarhanAliRaza

@FarhanAliRaza FarhanAliRaza commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Engine features

Honored by the live client and the static SVG/PNG exports alike:

  • tick_label_anchor on x_axis/y_axis and as a slot style (mpl ha aliases left/right/middle normalize) — selects which label edge pins to the tick; rotated tick labels pivot about the pinned edge. This is the mpl ha= semantic the pyplot shim emits for slanted categorical labels.
  • theme(background=) is the figure background (mpl figure.facecolor): it paints the whole card — margins, title, tick labels — and shows through the plot rect. --chart-bg / plot_background now scopes to the plot rect only (mpl axes.facecolor). Static exports reproduce both fills.
  • Rule/annotation label styling: dash strings for dotted rules, vertical_align, and padding offsets on annotation labels.

Docs updated in docs/engineering/styling.md; parity tests across components, CSS mark styles, SVG/PNG export, and pyplot layout no-ops.

Engine features, honored by the live client and static SVG/PNG exports
alike:

- tick_label_anchor on x_axis/y_axis and as a slot style (mpl ha aliases
  normalize): which label edge pins to the tick; rotated tick labels
  pivot about the pinned edge.
- theme(background=) is the figure background (mpl figure.facecolor),
  painting the whole card (margins, title, tick labels); --chart-bg /
  plot_background now scopes to the plot rect only.
- Rule/annotation label styling: dash strings, vertical_align, padding
  offsets.

Showcased by the new examples/demo-advance.ipynb (benchmark-style bar
chart + ExploitBench line/scatter recreation) and its Chromium-engine
PNG build at examples/exploitbench.png.
@FarhanAliRaza
FarhanAliRaza force-pushed the advanced-demo-styling branch from 5a39071 to 69ec1f9 Compare July 17, 2026 17:34
@FarhanAliRaza FarhanAliRaza changed the title Advanced demo notebook with axis anchor and figure-background styling Axis tick-label anchoring, figure-background theming, and rule-label styling Jul 17, 2026
@codspeed-hq

codspeed-hq Bot commented Jul 17, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 94 untouched benchmarks
⏩ 1 skipped benchmark1


Comparing advanced-demo-styling (0762b47) with main (7ab6028)

Open in CodSpeed

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports.

@FarhanAliRaza

Copy link
Copy Markdown
Contributor Author

Before
Screenshot From 2026-07-17 19-35-23

After

image

# Conflicts:
#	js/src/20_theme.js
#	js/src/50_chartview.js
#	python/xy/_raster.py
#	python/xy/_svg.py
#	python/xy/static/index.js
#	python/xy/static/standalone.js
#	tests/test_components.py
Arrow labels no longer sit exactly on the shaft midpoint: the client
lifts them along the shaft's upward normal so the line doesn't strike
through the text (#63). The alignment probe still asserted the old
center-x-equals-midpoint contract and failed once a Chromium is
available (CI skips these probes). Assert the new geometry instead:
no tangential drift along the shaft, and a normal offset large enough
that the label box clears the line.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant