【python】6DOF analyse tool3

  1. result show
    1.1 note: 图time, and position x ,and add anotions check timestamps 。
    请添加图片描述
  2. code
import matplotlib.pyplot as plt

path = '/home/sun/code/jitter/jitter_analyse_fit_spots1.txt'
data_list = []
with open(path,'r') as file:
    for line in file:
        data_list.append(line.strip().split(' '))

data = np.array(data_list,dtype=np.float64)
# print(data)

# 提取出时间、位置和姿态角度信息
time = [row[0] for row in data]
positions = [[float(row[1]), float(row[2]), float(row[3])] for row in data]
angles = [[float(row[4]), float(row[5]), float(row[6])] for row in data]

# print(time)
# print(positions)
# 绘制图形
fig, axs = plt.subplots()

# 绘制x曲线图
# axs.plot(time, [p[0] for p in positions], c='g',marker='+',)
axs.scatter(time, [p[0] for p in positions],c='g',marker='+')

for i,j in zip(time,positions):
    axs.annotate(f"({
      
      i}, {
      
      j[0]})", xy=(i, j[0]), xytext=(10, 10), textcoords="offset points")

axs.set_xlabel('time')
axs.set_ylabel('x')

plt.show()
  1. data
7.8198e+06 -1.52144 -1.12107 -0.727647 2.92137 2.54912 -0.88932
7.81983e+06 -1.53376 -1.11205 -0.721903 2.904 2.58714 -0.900095
7.81986e+06 -1.53927 -1.1263 -0.654146 2.84087 2.70335 -0.983318
7.8199e+06 -1.55025 -1.1412 -0.556699 2.68914 2.78244 -1.01721
7.8201e+06 -1.52144 -1.12113 -0.727615 2.92137 2.54914 -0.889437
7.82013e+06 -1.53369 -1.11211 -0.721936 2.90378 2.58706 -0.900729
7.82016e+06 -1.53927 -1.12634 -0.654154 2.84089 2.70291 -0.983781
7.8202e+06 -1.55031 -1.14126 -0.556621 2.69017 2.78192 -1.01811
7.82039e+06 -1.52146 -1.12116 -0.727593 2.92121 2.54914 -0.889546
7.82043e+06 -1.53398 -1.11195 -0.721513 2.90295 2.58855 -0.901212
7.82046e+06 -1.53916 -1.12637 -0.654467 2.83977 2.7066 -0.985384
7.82049e+06 -1.54991 -1.14085 -0.559475 2.69157 2.78589 -1.0204
7.82069e+06 -1.52146 -1.12117 -0.727582 2.92122 2.54917 -0.889614
7.82073e+06 -1.53395 -1.11197 -0.721537 2.90312 2.58815 -0.901176
7.82076e+06 -1.53919 -1.1264 -0.654313 2.84008 2.70572 -0.985084
7.82079e+06 -1.54997 -1.14092 -0.559067 2.69188 2.78464 -1.01984
7.82099e+06 -1.52146 -1.12117 -0.727584 2.92123 2.54912 -0.889568
7.82103e+06 -1.53392 -1.11198 -0.721585 2.90322 2.58811 -0.901002
7.82106e+06 -1.5392 -1.12638 -0.654354 2.84017 2.70554 -0.984895
7.82109e+06 -1.54998 -1.14093 -0.558925 2.69178 2.78457 -1.01982
7.82129e+06 -1.52147 -1.12117 -0.72758 2.92118 2.5491 -0.889566
7.82133e+06 -1.53392 -1.11199 -0.721603 2.90328 2.58782 -0.900883

猜你喜欢

转载自blog.csdn.net/Darlingqiang/article/details/129879144