Aug-06-2018, 07:59 PM
Example:
In future also look into Pandas and Jupyter Notebook.
This can make it easier to load and work with data/plot.
import matplotlib.pyplot as plt plt.style.use('ggplot') import csv x = [] y = [] with open('x_y.txt') as csv_file: plots = csv.reader(csv_file, delimiter=',') for row in plots: x.append(int(row[0])) y.append(int(row[1])) plt.plot(x,y, label='Loaded from file!') plt.xlabel('x') plt.ylabel('y') plt.title('Graph x y') plt.legend(loc='upper left', shadow=True, fontsize='large') plt.show()x_y.txt:
Output:1,5
2,3
3,4
4,7
5,4
In future also look into Pandas and Jupyter Notebook.
This can make it easier to load and work with data/plot.