Skip to content

Bezier

bumplot.bezier.bezier_curve(x, y, force)

Generate vertices and path codes for a smooth cubic Bézier curve passing through a sequence of points.

This function is used under the hood by bumplot(), but you can use it too.

Parameters:

Name Type Description Default
x ndarray

X-coordinates of the points.

required
y ndarray

Y-coordinates of the points.

required
force float

Smoothing factor controlling curve tightness. Higher values increase curvature by moving control points further away from the anchors.

required

Returns:

Name Type Description
vertices list[tuple[float, float]]

List of (x, y) vertices including control points for the Bézier segments.

codes list[int]

Corresponding matplotlib Path codes for constructing the curve.