如何使用gnuplot绘制数据差异很小的数据文件列 [英] How to draw data file column with very small data difference using gnuplot

查看:111
本文介绍了如何使用gnuplot绘制数据差异很小的数据文件列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含7列的数据文件,其中我需要绘制第一列与第4、5、6和7列. 数据文件如下所示:

I have a data file with 7 columns in which I need to draw the first column versus 4th, 5th, 6th and 7th column. The data file looks like the following:

1.005146    1   2   0   0   0   0
1.006025    1   2   0   0   0   0
1.008025    1   2   0   0   0   0
1.010025    1   2   0   0   0   0
1.012025    1   2   0   0   0   0
1.014025    1   2   0   0   0   0
1.015146    1   2   0   0   0   0
1.016025    1   2   0   0   0   0
1.018025    1   2   0   0   0   0
1.020025    1   2   0   0   0   0
......

当我尝试使用以下命令绘制图形时,我只有一点:

when I try to plot the graph using the following command, I got only one point:

plot "queuelength.txt" using 4 with linespoints 1

,并警告同时调整x和y范围.因此,要修复此问题,请使用实际的x和y范围

and a warning to adjust both x and y range. So to fix it I use the actual x and y range

plot [0:40][0:50] "queuelength.txt" using 4 with linespoints 1

但是我什么也没得到!所以我试图将10行的第一列数据从1更改为10,并且可以正常工作!那么这是否意味着gnuplot无法处理每行之间的差异非常小(等于0.002)的数据? 无论如何有处理或使用gnuplot绘制它?

But I got nothing!! so I've tried to change the first column data for 10 rows from 1 to 10 and it works!! so does that mean gnuplot can't deal with a data that has very small difference equals to 0.002 between each row? Is there anyway to deal with it or to draw it using gnuplot?

推荐答案

您的数据文件仅包含回车符(ASCII 13,\r)作为行尾. Gnuplot无法正确处理这些问题.您必须使用换行符(ASCII 10,\n)或两个\r\n作为换行符.

Your data file contains only carriage returns (ASCII 13, \r) as line endings. Gnuplot cannot handle those properly. You must have line feeds (ASCII 10, \n), or both \r\n as line endings.

对我有用的是

plot '< sed ''s/\r/\n/g'' qlength_map1.txt' using 1:4

这篇关于如何使用gnuplot绘制数据差异很小的数据文件列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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