Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
f7387f6
Collapse an axis's layout slot when its text is switched off
sselvakumaran Sep 22, 2026
1b8798d
Name the news fragment for its PR
sselvakumaran Sep 22, 2026
3d9ebb6
Reserve a gutter for a visible axis title, and check parity on every …
sselvakumaran Sep 22, 2026
b3e9c9c
Ask whether a title is drawn before reserving its gutter
sselvakumaran Sep 22, 2026
e99e1f8
Let the tick-label strategy decide tick-label room only
sselvakumaran Sep 22, 2026
06670f6
Ask the colorbar's right-axis room the same question layout asks
sselvakumaran Sep 22, 2026
e2bc976
Read the polar recut's insets from the same visibility rules
sselvakumaran Sep 22, 2026
2bc8b0d
Reserve for tick marks and for the title band they sit beside
sselvakumaran Sep 22, 2026
c1e562b
Say in the styling spec that a drawn title reserves its measured band
sselvakumaran Sep 22, 2026
765f126
Keep the x-axis band whole, and grow a top title inward
sselvakumaran Sep 22, 2026
ce0baed
Tick geometry is not tick ink
sselvakumaran Sep 22, 2026
e7a7cc2
Reserve tick marks per side, and stop clamping what the renderers do not
sselvakumaran Sep 22, 2026
72c62bb
Round only the title band, not the tick-label band beside it
sselvakumaran Sep 22, 2026
c951089
Make a zero-width tick mean the same thing in every renderer
sselvakumaran Sep 22, 2026
13c7dd8
Let the gutter being asked about name its own dimension
sselvakumaran Sep 22, 2026
aaf39b6
Measure the two tick tiers apart, because they are drawn apart
sselvakumaran Sep 22, 2026
721a4f5
A named axis has no minor tier to reserve for
sselvakumaran Sep 22, 2026
fb8e445
Reference the tier's own length in the minor-gutter thresholds
sselvakumaran Sep 22, 2026
e9b1867
Marks with no label reserve the marks, not a label
sselvakumaran Sep 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion docs/components/axes.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,13 @@ xy.x_axis(line=False, ticks=False) # tick labels, no baseline or ticks

The switches compile to ordinary axis `style` properties, so they work in HTML,
SVG, and native PNG alike, and an explicit `style=` property still wins over a
switch. `text` controls whether axis text is *drawn*; `tick_labels=` supplies
switch. An axis with nothing left to draw also reserves nothing: its tick-label
gutter collapses, on either side, so `show=False` on both axes plus `padding=0`
gives a plot that reaches the container edge — the sparkline case. Authored
`padding` is still reserved, and with no `padding` at all the label-aware
default margins still apply; what a switched-off axis no longer adds is a
gutter of its own. A grid survives that, since it
is drawn inside the plot and never needed a gutter. `text` controls whether axis text is *drawn*; `tick_labels=` supplies
the label strings.

## Style Axes
Expand Down
287 changes: 255 additions & 32 deletions js/src/50_chartview.ts

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions news/522.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
`xy.x_axis(show=False)` and `xy.y_axis(show=False)` now collapse the axis's
layout slot instead of painting an invisible axis in a gutter it still
occupies. With `padding=0` a chart whose axes are switched off reaches the
container edge — the sparkline case the axes docs describe — rather than
sitting 25 px in, and a hidden right-side axis no longer reserves its flat
54 px. Without an authored `padding` the label-aware default margins still
apply, as they always have; what changes is that a hidden axis no longer adds
its own gutter on top. The visibility shorthands compile to transparent paints
rather than to a flag, and the browser was measuring that invisible text back
into the gutter; the SVG and PNG exporters already skipped it on the left, so
the same chart exported flush and rendered inset. Both renderers now ask the
same question about the paint, on every side. `tick_label_strategy="off"` now
claims no tick-label room, the way `"none"` already did, while keeping the room
for the title it still draws — `"none"` suppresses that title too. Outward tick
marks answer to no text paint at all, so an axis that draws only those keeps
its band. A gutter is kept for an axis title only where a title is actually
drawn — not under
`tick_label_strategy="none"`, which suppresses the title as well, and not for an
`inside_*` title, which is drawn over the plot. Polar charts read the same
rules: switching the angular labels off reclaims the disc's inset whichever
switch does it, and the radial and angular titles keep their gutters only while
they are drawn. Axes that draw their text reserve exactly the room they did
before.
231 changes: 206 additions & 25 deletions python/xy/_svg.py

Large diffs are not rendered by default.

37 changes: 33 additions & 4 deletions spec/api/styling.md
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,34 @@ xy.y_axis(show=False, grid=True) # horizontal guides only
xy.x_axis(line=False, ticks=False, style={"grid_color": "#1e293b"})
```

The switches control what is *painted*, not the layout: the plot rect is
unchanged, because the gutters are reserved by `padding`. An edge-to-edge
sparkline is `show=False` **plus** `padding=0`.
The switches control what is *painted*, and layout follows the paint: an axis
with nothing left to draw reserves nothing, so its automatic gutter collapses
on every side. Authored `padding` is untouched — it is a floor the switches
never lower — so an edge-to-edge sparkline is still `show=False` **plus**
`padding=0`, and with no `padding` the label-aware defaults below continue to
apply. Every renderer decides this the same way, from the compiled paint
rather than from a flag: a transparent tick-label paint, or a
`tick_label_strategy` of `"none"` or `"off"`, claims no tick-label room. The
axis title is reserved separately and answers to `label_color` alone, so an
opaque title over switched-off ticks keeps the band it is drawn in — unless it
is not drawn at all, which is the case for `tick_label_strategy="none"` (which
suppresses the title too, where `"off"` keeps it) and for an `inside_*`
`label_position` (drawn over the plot, so it needs no band). A title that *is*
drawn reserves the band it is drawn in, measured: the automatic gutters are a
floor for ordinary text, not a ceiling the title is clipped against. Outward
tick marks answer to no text paint at all, so an axis whose labels are switched
Comment thread
sselvakumaran marked this conversation as resolved.
off while its `tick_length` still draws marks keeps its band for them. The two
tick tiers are reserved independently, because they are drawn independently:
the major tier is drawn for the computed ticks, on every `tick_sides`, in
`style`'s `tick_color`, while the minor tier is drawn only for the positions
`minor_tick_values` supplies, on `side` alone, in `minor_style`'s own
`tick_color`. So a `minor_style` with no `minor_tick_values` paints nothing
and claims nothing; a minor tier with values claims its reach whatever the
major tier's paint says; and an axis whose `tick_sides` send its major marks
to the opposite edge still keeps the band its minor marks are drawn in. Only
the primary `x` and `y` axes have a minor tier: a named axis draws its major
marks and stops, so it reserves for those and never for a minor tier it will
not paint.

### Plot rectangle and chrome reservations

Expand Down Expand Up @@ -432,7 +457,11 @@ Two asymmetries are deliberate, not oversights:
plot-relative (`plot-right + 40`) rather than to a canvas inset, so widening
only the static exporters' right gutter would move their title away from the
browser's. Unusually wide right-side tick labels can therefore still meet
their axis title, in every renderer alike.
their axis title, in every renderer alike. The flat *width* is what this
fixes; whether the gutter is reserved at all still answers to the paint, as
the left gutter does — an axis whose text is switched off holds none of what
the gutter exists for and claims none of it, in the browser and the exporters
alike.
- **Only a spec-authored `padding` reaches the browser.** `layout()` is a Python
function; a chart rendered live with `padding=None` gets ChartView's own
`46/62` default, not the measured floor. The pyplot shim closes that gap on the
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 13 additions & 6 deletions spec/design/polar-axes.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,19 @@ Eight properties this pins down, each of which has matching coverage:
full text stays in `title`/ARIA. Nothing is reserved when the author supplied an
`anchor` (an explicit plot-relative placement they own, still resolved against
the plot) or a four-tuple `padding` (which already states the box the plot
should occupy, and remains the way to hand-reserve a caption band), and nothing
is reserved for a figure whose angular axis is `tick_label_strategy="none"` —
that early return skips the whole recut, and it is the donut/gauge case whose
chrome the author has already taken over. Both static exporters bound their
legend so an oversized one ellipsizes instead of escaping the file, and that
bound is `legend_clip_rect` — the plot rect **unioned** with the gutter, shared
should occupy, and remains the way to hand-reserve a caption band), and no
tick-label room is reserved for a figure whose angular axis draws no tick
label — a `tick_label_strategy` of `"none"` or `"off"`, or a tick-label paint
the visibility shorthands have made transparent. That is the same question every
cartesian gutter asks (`_axis_tick_labels_visible` / `_axisTickLabelsVisible`),
and it is the donut/gauge case whose chrome the author has already taken over.
Only that inset goes: a legend gutter is still taken, the figure-title band
above the disc is never reclaimed, and the radial and angular titles answer
separately, to `_axis_title_visible` — a drawn title keeps the gutter it is
placed in, while a hidden or `inside_*` one keeps none. Both static exporters
bound their legend so an oversized one ellipsizes instead of escaping the
file, and that bound is `legend_clip_rect` — the plot rect **unioned** with
the gutter, shared
so the SVG `clipPath` and the raster clip command cannot drift. Clipping to the
plot rect alone is not a smaller legend but no legend: the gutter is outside it
by construction, so the whole box falls away.
Expand Down
Loading
Loading