ellphi.visualization
Matplotlib helpers for rendering ellipse clouds. For most use cases, EllipseCloud.plot() is the recommended entry point — it calls ellipse_patch internally.
import matplotlib.pyplot as plt
from ellphi.visualization import ellipse_patch
fig, ax = plt.subplots()
patch = ellipse_patch(center, r_major, r_minor, theta, edgecolor="teal", alpha=0.5)
ax.add_patch(patch)
ax.set_aspect("equal")
plt.show()
ellphi.visualization
ellphi.visualization – visualization helpers for ellipse cloud
ellipse_patch(X, r_major=1, r_minor=1, theta=0, *, cov=None, scale=1, **kwgs)
Creates a matplotlib Ellipse patch.
This function can create an ellipse patch from either the major and minor axes and angle, or from a covariance matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X |
The center of the ellipse. |
required | |
r_major |
int
|
The major radius of the ellipse. |
1
|
r_minor |
int
|
The minor radius of the ellipse. |
1
|
theta |
int
|
The angle of the major axis in radians. |
0
|
cov |
An optional covariance matrix. If provided, |
None
|
|
scale |
int
|
An optional scaling factor for the ellipse. |
1
|
**kwgs |
Additional keyword arguments to pass to the |
{}
|
Returns:
| Type | Description |
|---|---|
|
A |
Examples:
>>> import matplotlib.pyplot as plt
>>> from ellphi.visualization import ellipse_patch
>>> patch = ellipse_patch([0, 0], r_major=2.0, r_minor=1.0, theta=0.0)
>>> type(patch).__name__
'Ellipse'