26 lines
647 B
Python
26 lines
647 B
Python
import matplotlib.pyplot as plt
|
|
|
|
x_coords = []
|
|
y_coords = []
|
|
|
|
try:
|
|
filename = input("Input name: ")
|
|
with open(f'{filename}', 'r') as file:
|
|
lines = file.readlines()
|
|
|
|
for line in lines[2:]:
|
|
if line.strip():
|
|
x, y = map(float, line.strip().split())
|
|
x_coords.append(x)
|
|
y_coords.append(y)
|
|
|
|
plt.figure(figsize=(10, 6))
|
|
plt.scatter(x_coords, y_coords, s=10, c='blue', alpha=0.5)
|
|
plt.xlabel('X')
|
|
plt.ylabel('Y')
|
|
plt.grid(True)
|
|
plt.axis('equal')
|
|
plt.savefig(f"{filename[:-4]}.png")
|
|
plt.show()
|
|
except FileNotFoundError:
|
|
print(f"{filename} not found. ABORT!") |