Mathematica ListPlot从同一个表中的两列作为(x,y)图

时间:2015-08-10 18:23:05

标签: wolfram-mathematica

我是Mathematica的新手,尝试ListPlot第一列中有时间的数据集以及第2列和第3列中的值。

t = Import["/.../time_deltas.csv", "CSV"]

{{11.1694,0.,0},       {11.1697,0.000275,0}, {11.1702,0.000495,0}, 
 {11.1702,0.000028,0}, {11.1702,1.*10^-6,0}, {11.1702,0.000033,0},
 {11.1707,0.000502,0}, {11.171,0.000314,0},  {11.171,4.*10^-6,0}, 
 {11.1711,0.000025,0}, {25.8519,0.000029,1}, {25.852,0.000049,1},
 {25.852,0.000032,1},  {25.8521,0.000031,1}, {25.8524,0.000388,1},
 {25.8524,1.*10^-6,1}, {25.8525,0.000051,1}, {25.8543,0.001852,1},
 {25.9342,0.079813,0},{25.9391,0.004914,0}}

绘制单点我预计:

ListPlot[{t[[1,2,1]],t[[1,2,2]]}] 

会使用x=11.169662y=0.000275绘制单个点。相反,它会使用x=1,2y=11.169662, 0.000275绘制两个点。

我做错了什么?

1 个答案:

答案 0 :(得分:0)

您需要将数据分组为每个列表图的x-y对,例如

u = {{#1, #2}, {#1, #3}} & @@@ t;
v = Transpose[u];
GraphicsColumn[{ListPlot[v[[1]]], ListPlot[v[[2]]]}]

v[[1]]显示您期望的数据对:

  

{{11.1694,0。},{11.1697,0.000275},{11.1702,0.000495},...}