How to draw data file column with very small data difference using gnuplot

早过忘川 提交于 2019-12-11 16:23:59

问题


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

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

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?


回答1:


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.

What works for me is

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


来源:https://stackoverflow.com/questions/33302790/how-to-draw-data-file-column-with-very-small-data-difference-using-gnuplot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!