Radial Bar Charts in Python
A radial bar chart (also called a radial bar plot or radial bar graph)
encodes each value as an annular sector. The bar's first
channel is its center angle, its second is its radial height, width controls
the angular span, and base controls the inner radius.
Jump to a basic radial bar chart, inner radius and sector geometry, or partial gauges.
The first example keeps that geometry intentionally small. The blocks after it combine XY's exportable sectors with ordinary Reflex layout for center values, legends, rails, and summary statistics. This keeps the visualization reusable without forcing dashboard UI into the chart itself.
Basic Radial Bar Chart
Start with six named values at evenly spaced angles. Each row also carries one shade from the purple palette used throughout these docs:
RADIAL_DATA stays independent of the chart construction, so labels, values,
and colors are easy to replace. The named one-bar marks populate the legend,
while the authored ticks keep the angular and radial axes easy to read. Pass
one scalar width for equal angular spans or a same-length sequence for
per-bar spans. Widths must be finite and positive.
Allocation Overview
Small progress rings work well when several categories share one maximum. Each ring below is an explicit muted track plus a colored foreground sector; the table repeats the values for exact lookup:
The rings use a common radial domain and thickness. The percentage controls
only the foreground width, while the track remains a complete annulus. The
labels and exact dollar values stay in Reflex so the ring geometry can be
exported or reused independently.
Training Summary
A hero metric can share a card with compact radial KPIs. Here the primary distance and goal rail lead, while three rings summarize the supporting measurements and the narrow side column preserves quick operational context:
The chart helper owns only a track and foreground arc. The headline, horizontal goal rail, center values, and side statistics are ordinary layout, so they remain easy to restyle without changing the chart payload.
Cache Tiers
Nested semicircular bars can compare several capacities without repeating four separate plots. Every tier starts at the same angle; its foreground width is the used fraction of the shared 180-degree track:
Separate one-bar marks make it straightforward to give every tier a name,
gradient, and rounded edge. The sector=(-90.0, 90.0) axis fits the visible
semicircle to the available plot box instead of reserving space for the missing
half.
Build Your Own Radial Block
- Decide whether values control radial height, angular progress, or both.
- Author a muted track when every category shares a known maximum.
- Keep the track and foreground on the same
baseand radial height. - Convert a percentage to
percentage / 100 × 360for a full ring, or multiply by the declared partial-sector span. - Hide axes and the native legend when Reflex supplies the surrounding labels.
- Keep raw data and derived spans outside the chart construction.
XY does not add a background track or infer a maximum automatically. Explicit track marks make the maximum, thickness, color, and export behavior unambiguous.
Inner Radius and Sector Geometry
base is the inner radial edge, and the bar value is the height above it. A
scalar base opens the same hole beneath every bar; a sequence can give each bar
its own starting radius:
Filled sectors that cross the visible radial range are clipped at the inner or outer ring. A sector wholly outside the range disappears instead of reflecting through the center.
base= belongs to the mark and may differ per bar. For one chart-wide opening,
use r_axis(hole=...) to reserve a display-space inner fraction or
r_axis(origin=...) to set a data-space radial origin. hole and origin are
mutually exclusive.
A single sector with width=360 on a degree axis (or a full 2π width on a
radian axis) and a positive base draws a complete annulus. That is the track
used by the progress-ring blocks above.
Partial Gauges
Use sector=(start, end) for a gauge chart whose visible arc should expand to
fill the plot box. Rounded sectors, background-colored strokes, gradients, and
explicit padding work the same way on a partial layout:
ExpandCollapse
Use a scalar corner_radius for symmetric rounding. A gradient applies to the
whole mark and takes priority over a solid color. Use stroke_width to control
the separator or outline in screen pixels. Explicit
padding=(top, right, bottom, left) is preserved by the polar layout, so a
stable caption or legend band can be reserved without shifting the arc.
Angular Convention
Use xy.theta_axis(unit="degrees") when positions and widths are expressed in
degrees. Add zero="N", direction="clockwise" for compass bearings. With the
default radian axis, both the center angles and widths must be radians.
On theta_axis(), domain= is a compatibility alias for sector=; pass only
one. XY clips marks and ticks to that interval and fits the visible arc to its
own bounding box.
Interaction and Export
All live blocks on this page set xy.modebar(show=False) to keep the
presentation quiet. Sector hover, radial wheel zoom, double-click reset, and
browser/static exports remain available through the shared polar renderer.
Reflex-composed center values, rails, statistics, and custom legends are browser UI. The radial sectors themselves remain part of the XY chart and are preserved in SVG and native raster exports.
See the polar overview for shared axes, interaction, pyplot, large-data, and annotation limits.
Related Polar Charts
- Radar charts — compare values across named dimensions.
- Pie and donut charts — polished share, progress-ring, and gauge blocks.
- Wind rose charts — bin raw direction/speed observations into stacked radial bars.
- Bar charts — rectangular bars on Cartesian axes.
API Reference
xy.polar_bar_chart
Radial bars: each bar is an annular sector rather than a rectangle.
Props
| Prop | Type | Description |
|---|---|---|
*children | Component | `bar` marks plus axis/legend children. |
title | Optional[str] | Title shown above the plot. |
width | int | str | Chart width in pixels or a CSS size such as ``"100%"``. |
height | int | str | Chart height in pixels or a CSS size such as ``"100%"``. |
padding | Union[float, Sequence[float], None] | Plot margins, as one value or a sequence of side values. Use zero for an edge-to-edge sparkline. |
data | TableLike | Chart-level data used by marks that omit their own ``data``. |
class_name | Optional[str] | CSS class applied to the chart container. |
class_names | Optional[dict[str, str]] | CSS classes keyed by stable chart DOM slot. |
style | Optional[dict[str, StyleValue]] | Inline style overrides for the chart container. |
styles | Optional[dict[str, dict[str, StyleValue]]] | Inline style mappings keyed by stable chart DOM slot. |
on_hover | Optional[Callable[[dict], None]] | Callback receiving hover event payloads. |
on_click | Optional[Callable[[dict], None]] | Callback receiving picked-mark click payloads. |
on_brush | Optional[Callable[[dict], None]] | Callback receiving brush event payloads. |
on_select | Optional[Callable[[Selection], None]] | Callback receiving data-space selections. |
on_view_change | Optional[Callable[[dict], None]] | Callback receiving viewport change payloads. |
hover | Optional[bool] | Whether pointer movement emits hover events. |
click | Optional[bool] | Whether picked marks emit click events. |
select | Optional[bool] | Whether shift-drag box selection is enabled. |
brush | Optional[bool] | Whether brush selection is enabled. |
crosshair | Optional[bool] | Whether plot-aligned hover guides are shown. |
navigation | Optional[bool] | Whether browser pan and zoom navigation is enabled. |
pan | Optional[bool] | Whether plain-drag panning is enabled. |
pan_axes | Optional[tuple[str, ...]] | Declared axis IDs translated by pan gestures. |
zoom | Optional[bool] | Whether viewport zoom is enabled. |
default_drag_action | Optional[DefaultDragAction] | Initial action performed by a plain plot drag. |
zoom_axes | Optional[tuple[str, ...]] | Declared axis IDs changed by zoom gestures and controls. |
zoom_limits | Optional[ZoomLimits] | Minimum and maximum magnification globally or by axis. |
wheel_zoom | Optional[bool] | Whether wheel and trackpad zoom is available. |
box_zoom | Optional[bool] | Whether box zoom is available as a drag action. |
zoom_buttons | Optional[bool] | Whether modebar Zoom In/Out commands are available. |
double_click_reset | Optional[bool] | Whether double-click restores ``reset_axes``. |
reset_axes | Optional[tuple[str, ...]] | Declared axis IDs restored by reset. |
link_group | Optional[str] | Identifier used to synchronize charts in the browser. |
link_axes | Optional[tuple[str, ...]] | Axes synchronized within the link group. |
coords | str | Coordinate system, ``"cartesian"`` (default) or ``"polar"``. Under ``"polar"`` each mark's first channel is the angle and its second is the radius. Prefer ``xy.polar_chart(...)``, which sets this for you. |
FAQ
How do I add gaps between radial bars?
Place bar centers at the full bin spacing and choose a slightly smaller
width. For centers 30° apart, width=26 leaves a 4° gap.
How do I create a donut hole?
Set a positive base and choose a bar height that reaches the desired outer
radius. Hide both axes for a conventional ring presentation.
Can each sector have a different angular width?
Yes. Pass a width sequence with one finite, positive value per bar.