So I have this text file that i'm trying to plot. It has 5 columns of simulated data and im trying to plot each column from 2 - 5 to the 1st column.
import matplotlib.pyplot as plt
import numpy as np
with open('SampleData.txt') as f:
data = f.read()
data = data.split('\n')
x = [row.split(' ')[0] for row in data]
y = [row.split(' ')[1] for row in data]
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(x,y)
ax.legend()
plt.show()
returning
ValueError: could not convert string to float:
Anyway I can fix this?
Thank you