Python
import matplotlib.pyplot as plt
import numpy as np 
from numpy import arctan, arctan2
from math import tan,degrees,radians,asin,acos,sqrt

# rectangulo
x = [2, 2, 6, 6, 2, 2,6]
y = [5, 7, 7, 5, 5,7,5]

def distancia(x1, y1, x2, y2):
    return np.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
l1 = distancia(x[0], y[0], x[1], y[1])
l2 = distancia(x[1], y[1], x[2], y[2])
l3 = distancia(x[2], y[2], x[3], y[3])
l4= distancia(x[3], y[3], x[4], y[4])
l5= distancia(x[5], y[5], x[6], y[6])

dx2 = x[2] - x[3]  
dy2 = y[2] - y[3]  
angulo = degrees(arctan2(dy2, dx2))  



fig, ax = plt.subplots(figsize=(6, 4))


plt.text (5.2,6.5, f"Angulo: {angulo}")

posiciones = [( (x[0]+x[1])/2, (y[0]+y[1])/2 ),
              ( (x[1]+x[2])/2, (y[1]+y[2])/2 ),
              ( (x[2]+x[3])/2, (y[2]+y[3])/2 ),
              ( (x[3]+x[4])/2, (y[3]+y[4])/2 ),
              ( (x[5]+x[6])/2, (y[5]+y[6])/2 )]

ax.text(*posiciones[0], f"{l1:.2f}", ha="center", va="bottom", fontsize=10, color='blue')
ax.text(*posiciones[1], f"{l2:.2f}", ha="left", va="center", fontsize=10, color='blue')
ax.text(*posiciones[2], f"{l3:.2f}", ha="right", va="center", fontsize=10, color='blue')
ax.text(*posiciones[3], f"{l4:.2f}", ha="right", va="center", fontsize=10, color='blue')
ax.text(*posiciones[4], f"{l5:.2f}", ha="right", va="center", fontsize=10, color='blue')


ax.plot(x, y, marker='o')


ax.set_aspect("equal")
ax.set(xlabel='coordenada X', ylabel='coordenada Y', title='rectangulo')

ax.grid()
plt.show()
Matplotlib is building the font cache; this may take a moment.