Plot Module
Plot Steiner
This module provides the function plot_ellipse(), which plots an ellipse defined by its matrix
\(D\) and center \(p\). The function also plots the bounding box (BBOX) of the ellipse.
For more details on the definition of an ellipse and its BBOX, refer to
the qdecomp.utils.steiner_ellipse module.
- qdecomp.plot.plot_steiner_ellipse.plot_ellipse(ax: Axes, D: ndarray, p: ndarray, points: ndarray | None = None) None[source]
Plot the ellipse defined by matrix D and center p. The function also plots the BBOX of the ellipse and its center. Moreover, the (optional) points to plot are cyan if they lie inside the ellipse or magenta if they are not.
- Parameters:
ax (plt.Axes) – Axes to plot the ellipse
D (np.ndarray) – Matrix defining the ellipse’s shape and orientation
p (np.ndarray) – Center of the ellipse
points (np.ndarray) – Points to plot
Plot Grid Problems
This module contains functions to plot the solutions of 1D and 2D grid problems.
The module provides two functions:
plot_grid_problem_1d(): Plots the solutions of the 1D grid problem on the real axis.plot_grid_problem_2d(): Plots the solutions of the 2D grid problem for upright rectangles on the complex plane.
- qdecomp.plot.plot_grid_problem.plot_grid_problem_1d(ax: Axes, A: ndarray[tuple[Any, ...], dtype[floating]], B: ndarray[tuple[Any, ...], dtype[floating]], solutions: Sequence[Zsqrt2]) None[source]
Plot the solutions of the 1D grid problem on the real axis.
Given the two real intervals A and B and the list of solutions to their 1D grid problem, plot the solutions and their \(\sqrt{2}\)-conjugate on the real axis.
- Parameters:
ax (plt.Axes) – Matplotlib axis on which to plot the solutions.
A (Sequence[Real, Real]) – (A0, A1): Bounds of the first interval.
B (Sequence[Real, Real]) – (B0, B1): Bounds of the second interval.
solutions (Sequence[Zsqrt2]) – List of solutions to the 1D grid problem for A and B as Zsqrt objects.
- Raises:
TypeError – If intervals A and B are not real sequences of length 2.
TypeError – If solutions is not a sequence of Zsqrt2 objects.
- qdecomp.plot.plot_grid_problem.plot_grid_problem_2d(ax: Axes, A: ndarray[tuple[Any, ...], dtype[floating]], B: ndarray[tuple[Any, ...], dtype[floating]], solutions: Sequence[Zomega]) None[source]
Plot the solutions of the 2D grid problem for upright rectangles on the complex plane.
Given the two upright rectangles A and B and the solutions to their 2D grid problem, plot the solutions and their \(\sqrt{2}\)-conjugate on the complex plane.
- Parameters:
ax (plt.Axes) – Matplotlib axis on which to plot the solutions.
A (Sequence[Sequence[Real, Real]]) – ((Ax0, Ax1), (Ay0, Ay1)): Bounds of the first upright rectangle. Rows correspond to the x and y axis respectively.
B (Sequence[Sequence[Real, Real]]) – ((Bx0, Bx1), (By0, By1)): Bounds of the second upright rectangle. Rows correspond to the x and y axis respectively.
solutions (Sequence[Zomega]) – List of solutions to the 2D grid problem for A and B as Zomega objects.
- Raises:
TypeError – If intervals A and B are not real 2 x 2 nested sequences.
TypeError – If solutions is not a sequence of Zomega objects.