问题
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