Polar Area Charts

A pie chart variant where every slice spans an equal angle and the slice radius encodes the value. Larger values reach further out from the center, which makes magnitude differences easier to compare than slice angle alone.

../_images/polar_area.svg

Basic Usage

Pass a list of non-negative values, one per slice:

from charted.charts import PolarAreaChart

chart = PolarAreaChart(
    data=[10, 20, 30, 15, 25],
    labels=["A", "B", "C", "D", "E"],
    title="Activity by Category",
)
chart.save("polar_area.svg")

All slices share the same angular width of 360 / N degrees. Each slice’s radius is scaled by its value, with the smallest value still drawn as a visible sliver.

Rotation

Control the starting angle of the first slice:

chart = PolarAreaChart(
    data=[10, 20, 30, 15],
    labels=["N", "E", "S", "W"],
    start_angle=45,
)

Custom Colors

Override the default palette with a theme:

chart = PolarAreaChart(
    data=[10, 20, 30],
    labels=["A", "B", "C"],
    theme={
        "colors": ["#2ECC71", "#3498DB", "#E74C3C"]
    }
)

API Reference

class charted.charts.polar_area.PolarAreaChart(*args, **kwargs)[source]

Bases: PieChart

Polar area chart: a pie where every slice spans an equal angle and the slice radius encodes the value.

Unlike a pie chart (slice angle encodes value), here all slices share the same angular width of 360 / N degrees, and each slice’s radius is scaled by its value so larger values reach further out.

Parameters:
  • data (Vector) – Non-negative values, one per slice.

  • labels (Labels | None) – Optional labels for each slice.

  • width (float) – Chart dimensions in pixels.

  • height (float) – Chart dimensions in pixels.

  • title (str | None) – Optional chart title.

  • theme (Theme | None) – Optional theme configuration.

  • start_angle (float) – Starting angle in degrees (0 = top, clockwise).

  • series_styles (list[SeriesStyleConfig] | None) – Optional per-slice styling overrides.

  • show_radial_labels (bool) – Draw numeric labels on the radial scale rings (default True).

  • radial_levels (int) – Number of concentric scale rings to draw (default 5).

  • show_percentages (bool)

  • legend (str)

  • category_patterns (list[str] | bool | None)

Example

>>> from charted import PolarAreaChart
>>> chart = PolarAreaChart(
...     data=[10, 20, 30, 15],
...     labels=['N', 'E', 'S', 'W'],
... )
>>> chart.save('polar.svg')

Parameters:

  • data: Non-negative values, one per slice

  • labels: Labels for each slice

  • width: Chart width in pixels

  • height: Chart height in pixels

  • theme: Theme name string or theme dictionary

  • title: Chart title text

  • start_angle: Starting angle in degrees (0 = top, clockwise)

  • series_styles: Optional per-slice styling overrides

  • show_percentages: Show each slice’s percentage of the total

Example:

from charted import PolarAreaChart

chart = PolarAreaChart(
    data=[10, 20, 30, 15, 25],
    labels=["A", "B", "C", "D", "E"],
    title="Activity by Category",
    theme="dark",  # or "light", "high-contrast"
)
chart.save("polar_area.svg")
print(chart.to_markdown())  # ![Activity by Category](polar_area.svg)
slice_angles()[source]

Return (start, end) angle in degrees for each equal-width slice.

Return type:

list[tuple[float, float]]

slice_radii()[source]

Return the rendered radius for each slice, scaled by value.

Linear from the centre to the nice axis maximum, so a slice of value v reaches exactly the ring labelled v.

Return type:

list[float]

property representation: G

Render the pie chart.

to_config()[source]

Serialize chart configuration to a dict.

Returns a dict with all constructor parameters needed to recreate the chart, plus theme info.

Returns:

Dict suitable for JSON serialization or agent workflows.

Return type:

dict[str, object]