DOCUMENTATION / GUIDES
Plotting and themes
import numpy as np
import plotora as pt
x = np.linspace(0, 10, 300)
g = pt.plot(x, np.sin(x), label="Sine", xlabel="x", ylabel="Amplitude")
g.add(x, np.cos(x), label="Cosine", linestyle="--").hline(0, color="0.5")
g.show()
Standard plots accept theme, figsize (inches), xlabel, ylabel, title, xscale, yscale, xlim, ylim, grid and legend. Artist keywords are forwarded to Matplotlib for the standard plots; specialized helpers may accept fewer options.
Plot types and layouts
pt.scatter([1,2,3], [4,6,5], marker="o").show()
pt.errorbar([1,2,3], [4,6,5], yerr=[.2,.3,.2], fmt="o").show()
pt.heatmap([[1,2],[3,4]], cmap="viridis").show()
g = pt.figure(rows=1, cols=2, figsize=(9,3))
g.axes[0].plot(x, np.sin(x))
g.axes[1].plot(x, np.cos(x))
g.show()
Graph.ax is the first axis; Graph.axes is the native axes object or array. secondary_y() and secondary_x() return native twin axes. annotate, shade, hline, vline, add, save, save_all, show and close support chaining.
Themes
print(pt.themes())
pt.set_theme("academic")
pt.register_theme("lab", {"font.size": 10, "lines.linewidth": 2})
pt.function("cos(x)", theme="lab").show()
The available names are academic, engineering, minimal, midnight, blueprint, monochrome, ieee, latex, presentation, pastel and colorblind. pt.style() returns a Matplotlib rc context. The IEEE and LaTeX themes do not guarantee publisher compliance or enable external TeX.