I have a text file with 5 columns. The 1st one is the X-axis (1,2,3,4), and the rest of the columns are for the y-axis. I want to plot them in one graph.
1 0 0 0 0
2 7 14 2.53381 0.0691848
3 6 16 2.61242 0.0507856
4 6 17 2.65154 0.040285
I am trying this code for a single y value.
import matplotlib.pyplot as plt
import numpy as np
file_name = input("Enter the file name:")
x, y = np.loadtxt(file_name, delimiter=',', unpack=True)
plt.plot(x,y, label='Loaded from file!')
plt.xlabel('Action')
plt.ylabel('Rate')
plt.title('Plot of Rate')
plt.legend()
plt.show()
How can multiple y values be extracted, and plotted?



