import csv import matplotlib.pyplot as plt # Read the CSV file with open('test.dat', 'r') as csvfile: reader = csv.reader(csvfile) data = list(reader) # Extract the x and y values from the data x_values = [float(row[0]) for row in data] y_values = [float(row[1]) for row in data] # Create a figure and axis object fig, ax = plt.subplots() # Plot the data ax.plot(x_values, y_values) # Set the title and labels ax.set_title('Plot of test.dat') ax.set_xlabel('X Axis') ax.set_ylabel('Y Axis') # Show the plot plt.show()