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).
kaxe.Plot— standard Cartesian plotkaxe.BoxedPlot— axes pinned to the bottom-left cornerkaxe.PolarPlot— polar coordinateskaxe.LogPlot,kaxe.BoxedLogPlot— logarithmic axeskaxe.DoubleAxisPlot— two y-axeskaxe.EmptyPlot,kaxe.EmptyWindow— blank canvaseskaxe.Grid— multi-panel layoutskaxe.Plot3D,kaxe.PlotCenter3D,kaxe.PlotFrame3D,kaxe.PlotEmpty3D— 3D plots
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.
More guides
Recipes — copy-paste examples for common tasks
Styling — style keys, colors, themes, and
adjustLegends and Titles — titles, object legends, chart legends, symbols
Export and Display — PNG, SVG, Jupyter, and LaTeX inclusion
Charts
Charts are standalone windows — they are not added to a kaxe.Plot.
kaxe.BoxPlot— box-and-whisker chart (not the same askaxe.BoxedPlot)
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 |
|
Charts |
|
Smart objects |
|
Window methods |
|
Utilities |
|