I have points that represent a bounding box in a plot. I want to connect these points in order to make a box.
What I have:
import matplotlib.pyplot as plt
import numpy as np
coords = np.random.uniform(0, 10, (4, 2))
fig, ax = plt.subplots(figsize=(4, 4))
ax.scatter(*zip(*coords))
ax.plot(*zip(*coords), color='orange')
plt.show()
What I want:
Notes
All my coordinates form a perfect rectangle, that is always randomly rotated. I just don't know how to replicate that in a reproducible example.
I believe that the question proposed as duplicate doesn't answer my question. For one, it deals with rectangles.