我有一个文本文件,格式如下:
时间,秒A区,厘米A区,厘米B区,厘米B区,厘米PiA,毫微秒S.Pot,毫伏深度,毫米T.A.,厘米
103000 342.385783 44.343862-0.278713南0.060977-2.867612 5.000000
2233000 342.357189 44.340159-0.278713南0.069688-5.336944 5.000000
3.356000 342.128434 44.310532-0.202736南0.087109-8.045245 5.000000
4.488000 341.999759 44.293867-0.202736南0.093643 0.318624 5.000000
我想为x
数据-AreA,cm
和y
数据-PiA,mN/m
创建一个线性图。你知道吗
不幸的是,我不能跳过第一行,数据将无法正确加载。你知道吗
我在试这个:
import numpy as np
import matplotlib.pyplot as plt
with open('v10.txt') as f:
data = np.loadtxt(f, delimiter="\t", dtype='float',skiprows=0,)
x = data[:, 1]
y = data[:, 5]
fig = plt.figure()
fig.suptitle('')
plt.xlabel('')
plt.ylabel('')
plt.plot(-x, -y, c='r', label='')
leg = plt.legend()
plt.show()
谁都知道怎么做?你知道吗
提前谢谢!你知道吗
使用pandas的解决方案(可以使用
$ pip install pandas
安装)下面是一个使用您提供的数据的解决方案。访问文件内容时,只需跳过文件中的第一行即可
输出
相关问题 更多 >
编程相关推荐