数据集如下:名称:1.txt:
import pandas as pd
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif'] = ['SimHei'] #显示中文
plt.rcParams['axes.unicode_minus'] = False
fname = '10.txt'
isheader = 0
xlable = 'time(Seconds):*500ns'
ylable = 'Volts(V)'
title = '时序图'
data = pd.read_csv(fname,header = isheader)
#.iloc[:] = .iloc[行:列]
x = data.iloc[:,0].values
y = data.iloc[:,1].values
print(x[0],y[0])
print(x[2],y[2])
plt.figure('Time of Test: 0.0098557(s)')
plt.plot(x,y,c='r')
#plt.plot(x, y, marker='o', color = 'red', markersize='10', markeredgecolor = 'g', markeredgewidth = 5)
plt.grid(alpha=0.5,linestyle='-.')
plt.title(title,fontsize=10)
plt.xlabel(xlable,fontsize=10)
plt.ylabel(ylable,fontsize=10)
plt.show()
时序图结果如下: