API Reference
covvfit.create_spline_matrix(xs, n_coefs=5, degree=3, knots=None)
Creates basis spline functions evaluated at points provided.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
xs |
ndarray
|
points to evaluate the spline functions on, shape (N,) |
required |
n_coefs |
int
|
number of coefficients |
5
|
degree |
int
|
B-spline degree |
3
|
knots |
Optional[ndarray]
|
knot positions, should be of shape |
None
|
Returns:
Type | Description |
---|---|
ndarray
|
B-splines evaluated at the points provided. Shape (N, n_coefs) |
Note
The number of knots is given by n_coefs + degree + 1
Plotting
covvfit.plotting.plot_on_simplex(x, y, x_label='x', y_label='y', ax=None, line_color='gray', line_width=0.5, line_alpha=0.7, line_style='-', t=None, scatter_size=3 ** 2, scatter_cmap='Blues')
Plots a trajectory on the probability simplex.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
ndarray
|
x-coordinates of the trajectory, shape (n,) or (n, 1) |
required |
y |
ndarray
|
y-coordinates of the trajectory, shape (n,) or (n, 1) |
required |
x_label |
str
|
label for the x-axis |
'x'
|
y_label |
str
|
label for the y-axis |
'y'
|
ax |
Axes | None
|
axis to plot on. By default (None) a new axis is created |
None
|
line_color |
str | None
|
color of the trajectory line. If None, no line is plotted |
'gray'
|
line_width |
float
|
width of the trajectory line |
0.5
|
t |
ndarray | None
|
optional parameter to color the trajectory scatter |
None
|
scatter_size |
float
|
size of the scatter points |
3 ** 2
|
scatter_cmap |
str
|
colormap for the scatter points |
'Blues'
|
Returns:
Name | Type | Description |
---|---|---|
fig |
Figure | None
|
figure of the plot or None if |
ax |
Axes
|
axis of the plot |
covvfit.plotting.plot_grid(nrows, diag_func, under_diag, over_diag=set_axis_off, ncols=None, axsize=(2.0, 2.0), **subplot_kw)
Creates a grid of subplots.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nrows |
int
|
number of rows |
required |
diag_func |
Callable[[Axes, int], Any]
|
function to plot on the diagonal. Should have a signature (Axes, row_index) |
required |
under_diag |
Callable[[Axes, int, int], Any]
|
function to plot under the diagonal. Should have a signature (Axes, row_index, col_index) |
required |
over_diag |
Callable[[Axes, int, int], Any]
|
function to plot over the diagonal. Should have a signature (Axes, row_index, col_index) |
set_axis_off
|
ncols |
int | None
|
number of columns. By default equal to the number of rows |
None
|
axsize |
tuple[float, float]
|
size of the axes |
(2.0, 2.0)
|
subplot_kw |
keyword arguments passed to |
{}
|
Returns:
Type | Description |
---|---|
Figure
|
figure |
ndarray
|
array of axes, shape |
covvfit.plotting.set_axis_off(ax, i=0, j=0)
Hides the axis.