Skip to content

mosaickit: domain-neutral diagram scenes and rendering

mosaickit

A domain-neutral Python toolkit for assembling two-dimensional diagrams.

PyPI Python License

from mosaickit import (
    Canvas,
    Fill,
    FillLayer,
    MarkerLayer,
    PathLayer,
    Stroke,
    TextLayer,
    quadrant_axes,
)

canvas = Canvas().extend(quadrant_axes(10, 10))
canvas.add(
    FillLayer(
        [(1, 1), (1, 7), (8, 1)],
        fill=Fill(color="#377EB8", opacity=0.12),
        z_index=-1,
    )
)
canvas.add(
    PathLayer(
        [(1, 8), (2, 5), (4, 3), (7, 1.5), (9, 1)],
        stroke=Stroke(color="#984EA3", width=2),
    )
)
canvas.add(MarkerLayer([(4, 3)]))
canvas.add(TextLayer((4, 3), "A", offset=(8, 8)))
canvas.save("diagram.svg")

Features

Scope

mosaickit owns domain-neutral scene composition, styles, themes, parameter binding, grid layout, renderer contracts and static output. Domain semantics belong to the packages built on it. Curve construction and native TikZ path generation belong to geometry packages such as bezierkit.

Install

uv add mosaickit

Requires Python 3.10 or later. See Installation for extras and the development setup, or go straight to the Quick start.

Documentation

The following chapters cover mosaickit 1.0.0rc6.

Examples

The scripts that draw the figures in the manual and on these pages come as one zip, sorted by topic.

Download all examples

Comments