I want to make a graph for a paper. It is convenient to use Excel, but it seems that Excel is not good at mass-producing graphs of the same size (width and height). I'll forget it later, so make a note of it. Use the data saved in CSV.
Use spyder. Use pandas and matplotlib.
Read csv. Define the read value with the name df. Name the first, second, and third columns'num1','num2', and'num3', respectively. Check if CSV can be read properly with print. plt.plot (df ['num1'], df ['num2'], marker = "o") Write the X-axis as num1 and the Y-axis as num2. Plot with a marker. Save as PNG.
import pandas as pd import matplotlib.pyplot as plt
df = pd.read_csv('4.csv', names=['num1', 'num2', 'num3']) print(df) plt.plot(df['num1'], df['num2'],marker="o") plt.savefig("1.png ") plt.show()
The third column is not used. Put CSV in the same folder as .py.
Edited according to the format of the paper. Insert axis labels and legends
Recommended Posts