physics-frontend/index.py
2024-12-12 11:20:16 +03:00

22 lines
479 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import matplotlib.pyplot as plt
import requests
points_x = []
points_y = []
for point in requests.get("https://physics.zzvt.pw/api/interpolation?h=10&l=6&g=10&alpha=0.5&count=100").json():
points_x.append(point["x"])
points_y.append(point["y"])
plt.figure(figsize=(10, 6))
plt.scatter(points_x, points_y, c="blue", label="Точки", alpha=0.6)
plt.xlabel("x")
plt.ylabel("y")
plt.title("График с точками")
plt.legend()
plt.grid()
plt.show()