import matplotlib.pyplot as plt
def plot_hollow_rectangle(width, height):
plt.figure(figsize=(6, 6))
for x in range(width):
plt.scatter(x, 0, s=200, c='black')
plt.scatter(x, height-1, s=200, c='black')
for y in range(height):
plt.scatter(0, y, s=200, c='black')
plt.scatter(width-1, y, s=200, c='black')
plt.xlim(-1, width)
plt.ylim(-1, height)
plt.axis('off')
plt.gca().set_aspect('equal', adjustable='datalim')
plt.title("Hollow Rectangle Pattern Plot", fontsize=14)
plt.show()
plot_hollow_rectangle(10, 6)
#source code --> clcoding.com


0 Comments:
Post a Comment