Page 1 of 1

Load and Plot

PostPosted: Mon Nov 25, 2024 2:45 am
by hbyte
Code: Select all
import matplotlib.pyplot as plt

# Read data from file
with open('data.txt', 'r') as file:
    data = file.read().splitlines()

# Convert data to integers or floats
data = [int(i) for i in data]  # or use float(i) if your data contains decimals

# Plot the data
plt.plot(data, marker='o')
plt.title('Plot from File Data')
plt.xlabel('Index')
plt.ylabel('Value')
plt.show()