gnuplot-datafile中的单列不被接受 [英] Single column in gnuplot-datafile is not accepted

查看:122
本文介绍了gnuplot-datafile中的单列不被接受的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在gnuplot中绘制一些数据(在Ubuntu上为4.6.4),但遇到了一个奇怪的问题.我要绘制的数据是这样的:

I want to plot some data in gnuplot (4.6.4 on Ubuntu), and I am running into a strange problem. The data I want to plot is this:

0.200002, 1.802499 , -0.019630 , -0.026596 , 1
0.200004, 1.782499 , -0.019846 , -0.024755 , 1
0.399999, 1.802497 , -0.011159 , -0.033270 , 1
1.050001, 0.494397 , 0.014552 , -0.005899 , 5
0.549997, 1.782498 , -0.005215 , -0.032049 , 1
1.099996, 1.782499 , 0.019503 , -0.022157 , 1
0.750003, 0.454500 , 0.001421 , 0.014648 , 6
0.850000, 0.414497 , 0.002620 , 0.031995 , 6
0.750002, 0.434501 , -0.000733 , 0.020472 , 6
0.999999, 0.434499 , 0.009604 , 0.024800 , 6

如果将其另存为"cleaned.csv",则我可以正常运行

if it's saved as 'cleaned.csv' i have no problem to run

plot 'cleaned.csv' using 1

很好地绘制了第一列.我也可以绘制第二行或第四行,但是

Which nicely plots the first colum. I can also plot the second or fourth row, but

plot 'cleaned.csv' using 3

产生

     warning: Skipping data file with no valid points
                               ^
     x range is invalid

我不知道为什么这些列的行为会有所不同.

And I have no idea why this columns behaves differently.

别人有个主意吗?

推荐答案

Gnuplot使用空格作为数据列的分隔符.绘制第一列和第二列的效果很好,因为对于第一列,尾随的逗号将被忽略,而第二行由空格分隔.现在,第三列仅包含逗号,gnuplot无法将其解析为数字,因此您实际上没有有效的数据点.只需使用

Gnuplot uses white spaces as separators for the data columns. Plotting the first and second column works fine, because for the first column the trailing comma is simply ignored, and the second row is separated by a white space. Now, the third column contains only commas, which gnuplot cannot parse to numbers, so that you effectively have no valid data points. Simply use

set datafile separator ','

或者,因为4.6.6和5.0.0

or, since 4.6.6 and 5.0.0

set datafile separator comma

它工作正常.

这篇关于gnuplot-datafile中的单列不被接受的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆