MCPcopy Index your code
hub / github.com/TheAlgorithms/Python / plot

Function plot

fractals/koch_snowflake.py:92–106  ·  view source on GitHub ↗

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])

Source from the content-addressed store, hash-verified

90
91
92def 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
109if __name__ == "__main__":

Callers 1

koch_snowflake.pyFile · 0.70

Calls 2

plotMethod · 0.80
showMethod · 0.80

Tested by

no test coverage detected