Utility function to plot the vectors using matplotlib.pyplot No doctest was implemented since this function does not have a return value
(vectors: list[np.ndarray])
| 90 | |
| 91 | |
| 92 | def plot(vectors: list[np.ndarray]) -> None: |
| 93 | """ |
| 94 | Utility function to plot the vectors using matplotlib.pyplot |
| 95 | No doctest was implemented since this function does not have a return value |
| 96 | """ |
| 97 | # avoid stretched display of graph |
| 98 | axes = plt.gca() |
| 99 | axes.set_aspect("equal") |
| 100 | |
| 101 | # matplotlib.pyplot.plot takes a list of all x-coordinates and a list of all |
| 102 | # y-coordinates as inputs, which are constructed from the vector-list using |
| 103 | # zip() |
| 104 | x_coordinates, y_coordinates = zip(*vectors) |
| 105 | plt.plot(x_coordinates, y_coordinates) |
| 106 | plt.show() |
| 107 | |
| 108 | |
| 109 | if __name__ == "__main__": |
no test coverage detected