Global Parameters

Almost all chart functions in clean_charts share a common set of parameters. These control output, dimensions, titles, and styling. Each individual chart page lists these alongside its unique parameters with a Scope badge to distinguish them.


Output & Dimensions

Parameter Type Default Description
data pd.DataFrame Built-in sample Input tabular data. If None, uses a built-in sample dataset for demonstration.
output_path str | None None File path to save the chart (.png, .jpg, .pdf, .svg). If None, displays inline.
width int | None Auto Explicit image width in pixels.
height int | None Auto Explicit image height in pixels.
aspect_ratio str | None None Semantic sizing: "square", "landscape", "vertical", "1:1", "2:1", "1:2". Overrides width and height.

Titles & Labels

Parameter Type Default Description
title str | None None Bold header text, flush-left aligned. Auto-wrapped to fit chart width.
subtitle str | None None Lighter secondary text displayed below the title.

Styling

Parameter Type Default Description
bg_color str | None "#f4f3f0" Background hex color. Defaults to Economist cream.
scale_text bool True Scale fonts proportionally with image size.
value_suffix str "" String appended to data labels and axis ticks (e.g., "%", "M", "x").
show_percentages bool False Format numeric values as percentages (e.g., 0.25 → "25.0%").

Color Parameters

Many chart functions accept color parameters. The naming convention is:

  • color — single hex color for all elements (bars, dots, lines)
  • start_color / end_color — gradient boundary colors when multiple series or segments need differentiation
  • colors — explicit list of hex colors when you want full control per series