Getting Started

Kaxe is object oriented: create a plot or chart window, add content, style it, then save or show the result.

Installation

The default install includes 2D plotting only:

pip install kaxe

For 3D plots (OpenGL rendering), install the optional extra:

pip install kaxe[3d]

For PDF export, see Export and Display.

Complete example

This example shows the full workflow: bounds, objects, theme, title, and export.

import kaxe

plt = kaxe.Plot([-5, 5, -5, 5])
plt.add(kaxe.Function2D(lambda x: x**2 - 4))
plt.add(kaxe.Points2D([1, 2, 3], [1, 4, 9]))
plt.theme(kaxe.Themes.A4Medium)
plt.title("$x^2 - 4$")
plt.save("figure.png")
plt.save("figure.svg")

Minimal plot

import kaxe

plt = kaxe.Plot()
plt.show()

Plot windows

Plot windows hold drawable objects (functions, points, contours, and more).

See Plots for the full API reference.

Adding objects

Add objects with kaxe.Window.add(). Smart objects pick 2D or 3D based on the plot:

plt.add(kaxe.Function(lambda x: 2 * x - 1))
plt.add(kaxe.Points([0, 1, 2, 3], [0, 1, 2, 3]))

For explicit 2D types:

plt.add(kaxe.Function2D(lambda x: x**2))
plt.add(kaxe.Points2D([1, 2], [3, 4]))

See Objects for all object types.

Styling

Set individual style keys with kaxe.AttrMap.style():

plt.style(fontSize=80, lineWidth=4)

List available keys with kaxe.AttrMap.help():

plt.help()

Apply a page-sized preset with kaxe.Window.theme():

plt.theme(kaxe.Themes.A4Large)

Scale the figure to a fraction of an A4 page width with kaxe.Window.adjust():

plt.adjust(0.5)

See API Workflow for how plots, charts, objects, and styling fit together.

Charts

Charts are standalone windows — they are not added to a kaxe.Plot.

See Charts for per-chart usage and the full API.

Export

Save as PNG (default) or SVG (2D plots and charts):

plt.save("myplot.png")
plt.save("myplot.svg")

See Export and Display for format details, Jupyter usage, and LaTeX tips.

API quick reference

Category

Main symbols

Plot windows

kaxe.Plot, kaxe.BoxedPlot, kaxe.PolarPlot, kaxe.LogPlot, kaxe.Grid, kaxe.Plot3D

Charts

kaxe.Pie, kaxe.Bar, kaxe.GroupBar, kaxe.BoxPlot, kaxe.QQPlot

Smart objects

kaxe.Function, kaxe.Points, kaxe.Arrow, kaxe.ParametricEquation

Window methods

add, style, theme, adjust, title, save, show, help, zoom

Utilities

kaxe.Themes, kaxe.koundTeX(), kaxe.resetColor(), kaxe.setSetting(), kaxe.data.loadExcel()