API reference
Public signatures generated from the RC1 source. Task guides explain units, assumptions and examples. Plotting helpers return Graph unless described otherwise. Common plotting options are described in Plotting and themes.
Figures and styling
Graph
pt.Graph(fig: 'Any', axes: 'Any', data: 'Any' = None, metadata: 'dict' = <factory>, animation: 'Any' = None) -> None
Matplotlib-backed figure wrapper. Plot functions return this object.
Graph.show(self, *, block=None)Graph.close(self)Graph.save(self, path, *, dpi=300, **kwargs)Graph.save_all(self, stem, *, formats=('pdf', 'svg', 'png'), **kwargs)Graph.latex(self, caption='Figure', label='fig:plot', filename='figure.pdf', width='0.9\\linewidth')Graph.add(self, x, y, *, label=None, **kwargs)Graph.annotate(self, text, xy, **kwargs)Graph.hline(self, y, **kwargs)Graph.vline(self, x, **kwargs)Graph.shade(self, x, y1, y2=0, **kwargs)Graph.secondary_y(self)Graph.secondary_x(self)
Properties: ax (first axis), figure (alias of fig), axes, data, metadata.
figure
pt.figure(*, rows=1, cols=1, theme=None, figsize=(7, 4), **kwargs)
Create a native subplot layout.
themes
pt.themes() -> 'tuple[str, ...]'
List available theme names.
set_theme
pt.set_theme(name: 'str') -> 'None'
Set default theme.
register_theme
pt.register_theme(name: 'str', settings: 'dict', base: 'str' = 'academic') -> 'None'
Register an rcParams preset derived from a base theme.
style
pt.style(theme=None)
Return a Matplotlib rc_context.
Standard plots
plot
pt.plot(x, y=None, **kwargs)
Line plot; if y is omitted, x is treated as y values.
line
pt.line(x, y=None, **kwargs)
Alias of plot.
scatter
pt.scatter(x, y, **kwargs)
Scatter points.
bar
pt.bar(x, y, **kwargs)
Vertical bars.
hist
pt.hist(values, **kwargs)
Histogram of values.
area
pt.area(x, y, **kwargs)
Filled area to baseline.
boxplot
pt.boxplot(values, **kwargs)
Box-and-whisker plot.
stem
pt.stem(x, y, **kwargs)
Discrete stem plot.
polar
pt.polar(theta, r, **kwargs)
Polar plot; theta in radians.
pie
pt.pie(values, **kwargs)
Pie chart.
heatmap
pt.heatmap(z, *, colorbar=True, **kwargs)
Image-style 2D heatmap.
contour
pt.contour(x, y, z, *, filled=False, colorbar=False, **kwargs)
Contour or filled contour of a coordinate grid.
vector_field
pt.vector_field(x, y, u, v, **kwargs)
2D quiver plot.
errorbar
pt.errorbar(x, y, **kwargs)
Error bars using Matplotlib artist options.
compare
pt.compare(*series, **kwargs)
Compare tuples (x, y, label), with label optional.
LTspice
Simulation
pt.Simulation(axis_name: str, runs: list[pandas.core.frame.DataFrame], step_names: list[str]) -> None
Container for axis name, DataFrame runs and step labels.
Simulation.trace(self, name, step=0)Simulation.axis(self, step=0)Simulation.metrics(self, name, step=0, window=None)
Property: traces lists available trace names. runs holds DataFrames and step_names holds labels.
read_ltspice
pt.read_ltspice(path)
Read exported text or optional native RAW into Simulation.
ltspice
pt.ltspice(path, *, traces=None, time_unit='auto', step=None, component='magnitude', window=None, **kwargs)
Plot selected traces and steps.
compare_ltspice
pt.compare_ltspice(*paths, trace, labels=None, time_unit='ms', **kwargs)
Compare single-run transient files.
Engineering
transfer_function
pt.transfer_function(num, den)
Return a SciPy continuous-time transfer function.
bode
pt.bode(num=None, den=None, *, system=None, w=None, unit='rad/s', theme=None, figsize=(7, 6), title=None)
Return exact sampled magnitude and phase graphs.
bode_asymptotic
pt.bode_asymptotic(num, den, *, w=None, unit='rad/s', theme=None)
Compare exact and straight-line magnitude responses.
corner_frequencies
pt.corner_frequencies(num, den, *, unit='rad/s')
Return magnitudes of roots in selected units.
poles_zeros
pt.poles_zeros(*, poles=None, zeros=None, num=None, den=None, **kwargs)
Plot poles and zeros from roots or coefficients.
nyquist
pt.nyquist(num=None, den=None, *, system=None, w=None, unit='rad/s', **kwargs)
Plot sampled complex frequency response and its conjugate.
step_response
pt.step_response(num=None, den=None, *, system=None, t=None, **kwargs)
Plot continuous-time unit step response.
impulse_response
pt.impulse_response(num=None, den=None, *, system=None, t=None, **kwargs)
Plot continuous-time impulse response.
root_locus
pt.root_locus(num, den, *, gains=None, **kwargs)
Sample closed-loop roots for specified gains.
stability_margins
pt.stability_margins(num, den)
Return margin dictionary using optional control.
bandwidth
pt.bandwidth(num, den)
Return bandwidth in rad/s using optional control.
phasors
pt.phasors(values, **kwargs)
Plot named complex values from a dictionary.
impedance
pt.impedance(f, z, **kwargs)
Plot magnitude of complex impedance versus frequency.
power_triangle
pt.power_triangle(p, q, **kwargs)
Plot active/reactive components and record apparent power.
Signals
metrics
pt.metrics(t, y, *, window=None)
Return time-weighted signal statistics for real samples.
ripple
pt.ripple(t, y, *, window=None)
Return peak-to-peak value in the selected time window.
peaks
pt.peaks(y, **kwargs)
Return SciPy peak indices and properties.
resample
pt.resample(t, y, *, samples=None)
Return uniform time grid and linearly interpolated values.
spectrum
pt.spectrum(t, y, *, window=None, **kwargs)
Plot one-sided amplitude spectrum; requires uniform time samples.
fft
pt.fft(t, y, *, window=None, **kwargs)
Alias of spectrum.
spectrogram
pt.spectrogram(t, y, *, nperseg=256, **kwargs)
Plot PSD versus time and frequency.
timing
pt.timing(t, channels, **kwargs)
Plot named discrete channels as offset step traces.
harmonics
pt.harmonics(t, y, fundamental, *, count=10)
Fit harmonic amplitudes and phases by least squares.
phase_difference
pt.phase_difference(t, y1, y2, frequency)
Return phase of the second signal minus first, in degrees.
Mathematics
function
pt.function(expr, domain=(-10, 10), *, samples=1000, **kwargs)
Sample a real expression of x or callable.
parametric
pt.parametric(xexpr, yexpr, domain=(0, 6.283185307179586), *, samples=1000, **kwargs)
Plot x(t), y(t) over a parameter range.
taylor
pt.taylor(expr, degree=5, center=0, domain=(-3, 3), *, samples=1000, **kwargs)
Compare expression with symbolic Taylor polynomial.
derivative
pt.derivative(expr, domain=(-3, 3), **kwargs)
Plot symbolic derivative.
tangent
pt.tangent(expr, at, domain=(-3, 3), **kwargs)
Compare function and tangent at selected x.
integral
pt.integral(expr, a, b, *, samples=1000, **kwargs)
Shade integral region and report quadrature in metadata.
implicit
pt.implicit(expr, xlim=(-3, 3), ylim=(-3, 3), *, samples=250, **kwargs)
Plot zero-level contour or equality in x and y.
direction_field
pt.direction_field(expr, xlim=(-3, 3), ylim=(-3, 3), *, samples=20, **kwargs)
Plot normalized slope field dy/dx.
ode
pt.ode(rhs, tspan, y0, *, samples=500, rtol=1e-08, atol=1e-10, **kwargs)
Solve an initial value ODE and plot solution components.
vectors
pt.vectors(vectors, **kwargs)
Plot named 2D vectors as arrows.
transform
pt.transform(matrix, vectors, **kwargs)
Compare original and matrix-transformed point sequences.
fourier
pt.fourier(expr, terms=10, period=6.283185307179586, *, samples=1000, **kwargs)
Compare expression with truncated Fourier series.
sequence
pt.sequence(values, **kwargs)
Stem plot indexed from one.
Statistics
describe
pt.describe(y)
Return descriptive statistics, including sample variance.
regression
pt.regression(x, y, *, degree=1, model='polynomial', confidence=0.95, interval=None, **kwargs)
Fit polynomial, logarithmic or exponential model.
curve_fit
pt.curve_fit(x, y, func, *, p0=None, bounds=(-inf, inf), **kwargs)
Fit callable nonlinear model and record covariance.
residuals
pt.residuals(x, fit, **kwargs)
Plot residuals from regression or curve_fit metadata.
distribution
pt.distribution(name='norm', *, params=(), domain=None, **kwargs)
Plot supported continuous probability density.
correlation
pt.correlation(data, **kwargs)
Plot numeric DataFrame correlation matrix.
outliers
pt.outliers(y, *, threshold=3)
Return indices with absolute z-score above threshold.
integrate_data
pt.integrate_data(x, y)
Return trapezoidal integral.
differentiate_data
pt.differentiate_data(x, y)
Return finite-difference gradient.
interpolate_data
pt.interpolate_data(x, y, new_x, *, kind='linear')
Interpolate within the sample bounds.
smooth
pt.smooth(y, *, window=11, degree=2)
Apply Savitzky–Golay filter.
moving_average
pt.moving_average(y, window=5)
Return valid-window moving average (shorter output).
propagate
pt.propagate(func, values, standard_uncertainties, *, covariance=None)
Return nominal value and first-order standard uncertainty.
3D
surface
pt.surface(x, y=None, z=None, *, domain=((-3, 3), (-3, 3)), samples=80, **kwargs)
Plot 3D surface from expression, callable or coordinate grid.
wireframe
pt.wireframe(x, y=None, z=None, *, domain=((-3, 3), (-3, 3)), samples=50, **kwargs)
Plot 3D wireframe.
scatter3d
pt.scatter3d(x, y, z, **kwargs)
Plot 3D points.
line3d
pt.line3d(x, y, z, **kwargs)
Plot 3D curve.
vector_field3d
pt.vector_field3d(x, y, z, u, v, w, **kwargs)
Plot 3D quiver arrows.
contour3d
pt.contour3d(x, y, z, **kwargs)
Plot 3D contours.
Data and units
load
pt.load(path, **kwargs)
Load supported table or MATLAB arrays.
from_file
pt.from_file(path, x, y, **kwargs)
Load table and plot named x/y columns.
clean
pt.clean(data, *, columns=None, dropna=False, sort=None, fill=None)
Copy and filter, fill, drop or sort table rows.
normalize
pt.normalize(y)
Return min-max scaled values.
merge
pt.merge(*frames, **kwargs)
Merge tables using pandas options.
export_data
pt.export_data(data, path, **kwargs)
Write tabular data to supported format.
convert
pt.convert(value, from_unit, to_unit)
Convert compatible physical units; arbitrary units need Pint.
Export
animate
pt.animate(x, frames, *, interval=67, repeat=True, **kwargs)
Create a line animation from frame values.
latex_figure
pt.latex_figure(filename, caption, label, width='0.9\\linewidth')
Return LaTeX figure snippet.