Skip to content

Charts API

Factory options shared by all chart types: data, title, xlabel, ylabel, theme="blue", figsize=(7, 4.5), and font_size=11. Remaining keywords are passed to matplotlib. See chart examples.

tabloom.chart

Create themed matplotlib charts from vectors, DataFrames, or Tabloom tables.

The public Chart class provides six chart factories and exposes its Figure and Axes for advanced customization. Import it from tabloom or tabloom.chart. Common factory options and type-specific methods are documented below.

Chart Source

Chart(fig: Figure, ax: Axes)

A matplotlib figure created by a convenient chart factory.

Every factory accepts title, xlabel, ylabel, theme, figsize, and font_size. Additional keyword arguments go to its matplotlib plotting method. For column-based inputs, supply a pandas DataFrame or Tabloom Table as data. Use fig and ax to customize the result with normal matplotlib methods.

Store a Figure/Axes pair; normally use the chart factories.

line Source classmethod

line(x: Any = None, y: Any = None, **kwargs: Any) -> Chart

Create lines from vectors or named data columns.

Parameters:

Name Type Description Default
x Any

X values or category labels, or a column name when data is supplied.

None
y Any

Y values, bar heights, or a column name; must match the x length.

None
**kwargs Any

Common factory options (data, title, xlabel, ylabel, theme, figsize, font_size) and matplotlib plotting options. Use color, linewidth, marker, and label to customize lines.

{}

Returns:

Type Description
Chart

A Chart exposing its Figure and Axes through fig and ax.

Raises:

Type Description
TypeError

The input type or a plotting option is unsupported.

ValueError

Input lengths, dimensions, theme, or numeric values are invalid.

KeyError

A requested data column does not exist.

bar Source classmethod

bar(x: Any = None, y: Any = None, **kwargs: Any) -> Chart

Create vertical bars from vectors or named data columns.

Parameters:

Name Type Description Default
x Any

X values or category labels, or a column name when data is supplied.

None
y Any

Y values, bar heights, or a column name; must match the x length.

None
**kwargs Any

Common factory options (data, title, xlabel, ylabel, theme, figsize, font_size) and matplotlib plotting options. Use color and width to customize bars.

{}

Returns:

Type Description
Chart

A Chart exposing its Figure and Axes through fig and ax.

Raises:

Type Description
TypeError

The input type or a plotting option is unsupported.

ValueError

Input lengths, dimensions, theme, or numeric values are invalid.

KeyError

A requested data column does not exist.

scatter Source classmethod

scatter(x: Any = None, y: Any = None, *, hue: Any = None, colorbar: bool | None = None, colorbar_label: str | None = None, trendline: bool = False, trendline_kwargs: dict[str, Any] | None = None, **kwargs: Any) -> Chart

Create scatter points from vectors or named data columns.

Parameters:

Name Type Description Default
x Any

X values or category labels, or a column name when data is supplied.

None
y Any

Y values, bar heights, or a column name; must match the x length.

None
hue Any

Numeric color values or a column name when data is supplied. Adds a colorbar automatically. Cannot be combined with c or color.

None
colorbar bool | None

Show or hide the hue colorbar. None shows it when hue is set.

None
colorbar_label str | None

Colorbar label; defaults to the hue column name.

None
trendline bool

Add a least-squares line through finite numeric x/y pairs.

False
trendline_kwargs dict[str, Any] | None

Matplotlib line options such as label, color, linewidth, and linestyle. Requires trendline=True.

None
**kwargs Any

Common factory options (data, title, xlabel, ylabel, theme, figsize, font_size) and matplotlib plotting options. Use s for point size and c for numeric color values.

{}

Returns:

Type Description
Chart

A Chart exposing its Figure and Axes through fig and ax.

Raises:

Type Description
TypeError

The input type or a plotting option is unsupported.

ValueError

Input lengths, dimensions, theme, or numeric values are invalid.

KeyError

A requested data column does not exist.

hist Source classmethod

hist(x: Any = None, **kwargs: Any) -> Chart

Create a histogram from vectors or named data columns.

Parameters:

Name Type Description Default
x Any

Values or groups of values, or a column name when data is supplied.

None
**kwargs Any

Common factory options (data, title, xlabel, ylabel, theme, figsize, font_size) and matplotlib plotting options. Use bins and density to configure the histogram.

{}

Returns:

Type Description
Chart

A Chart exposing its Figure and Axes through fig and ax.

Raises:

Type Description
TypeError

The input type or a plotting option is unsupported.

ValueError

Input lengths, dimensions, theme, or numeric values are invalid.

KeyError

A requested data column does not exist.

box Source classmethod

box(x: Any = None, **kwargs: Any) -> Chart

Create box plots from vectors or named data columns.

Parameters:

Name Type Description Default
x Any

Values or groups of values, or a column name when data is supplied.

None
**kwargs Any

Common factory options (data, title, xlabel, ylabel, theme, figsize, font_size) and matplotlib plotting options. Use tick_labels, boxprops, and medianprops for grouped distributions.

{}

Returns:

Type Description
Chart

A Chart exposing its Figure and Axes through fig and ax.

Raises:

Type Description
TypeError

The input type or a plotting option is unsupported.

ValueError

Input lengths, dimensions, theme, or numeric values are invalid.

KeyError

A requested data column does not exist.

pie Source classmethod

pie(x: Any = None, **kwargs: Any) -> Chart

Create a pie chart from vectors or named data columns.

Parameters:

Name Type Description Default
x Any

Values or groups of values, or a column name when data is supplied.

None
**kwargs Any

Common factory options (data, title, xlabel, ylabel, theme, figsize, font_size) and matplotlib plotting options. Use labels or a labels column name, colors, and autopct for wedge annotations.

{}

Returns:

Type Description
Chart

A Chart exposing its Figure and Axes through fig and ax.

Raises:

Type Description
TypeError

The input type or a plotting option is unsupported.

ValueError

Input lengths, dimensions, theme, or numeric values are invalid.

KeyError

A requested data column does not exist.

show Source

show() -> None

Display this chart directly in a notebook or graphical backend.

Notebook output uses the existing Figure without saving an image file. Pyplot registration is cleaned up automatically after notebook display. Only this chart is displayed, and its figure remains available for customization, saving, and reuse in reports.

save Source

save(path: str | Path, *, dpi: float = 200, **kwargs: Any) -> None

Save PNG, PDF, or SVG without closing the chart.

Parameters:

Name Type Description Default
path str | Path

Destination filename with a supported graphical extension.

required
dpi float

Positive raster resolution in dots per inch.

200
**kwargs Any

Additional matplotlib Figure.savefig options.

{}

Raises:

Type Description
ValueError

The output extension or DPI is invalid.

The chart remains available for display, customization, and report composition.