2016-07-08 118 views
2

我写了下面的 “tmp.dat” 数据文件gnuplot的错误(?)绘制数据文件

\# 0;1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20 
\#inFile;cn;mv;nr;nd;nn;fil;sep;m#enn=;m#enn=;n=;i=;aLea1=;rLea1=;amea1=;rmea1=;NbaLea1=;NbrLea1=;Nbamea1=;Nbrmea1=;rrmen3a1= 
ex32new_DMLPG_beta3_der1emeno5/fort.501;0;?;?;?;?;0.0110485435;0.0078125;14;11.1540828402;4225;0;0.00898;0.00158;0.00205;0.00204;0.00898;0.00158;0.00205;0.00204;0.00172 
ex32new_DMLPG_beta3_der1emeno5/fort.501;1;0.0165088727;1745;64;0;0.0441941738;0.0078125;42;11.2126074499;1745;1;0.00898;0.00158;0.00205;0.00204;0.00898;0.00158;0.00205;0.00204;0.00172 
ex32new_DMLPG_beta3_der1emeno5/fort.501;2;0.0165088858;1726;64;0;0.0441941738;0.0078125;35;11.2027809965;1726;2;0.00898;0.00158;0.00205;0.00204;0.00898;0.00158;0.00205;0.00204;0.00272 
ex32new_DMLPG_beta3_der1emeno5/fort.501;3;0.0165088801;1724;64;0;0.0441941738;0.0078125;39;11.214037123;1724;3;0.00898;0.00158;0.00205;0.00204;0.00898;0.00158;0.00205;0.00204;0.00372 
ex32new_DMLPG_beta3_der1emeno5/fort.501;4;0.0165088766;1720;64;0;0.0441941738;0.0078125;34;11.1831395349;1720;4;0.00898;0.00158;0.00205;0.00204;0.00898;0.00158;0.00205;0.00204;0.00472 
ex32new_DMLPG_beta3_der1emeno5/fort.501;5;0.0165088776;1718;64;0;0.0441941738;0.0078125;32;11.1850989523;1718;5;0.00898;0.00158;0.00205;0.00204;0.00898;0.00158;0.00205;0.00204;0.00572 
ex32new_DMLPG_beta3_der1emeno5/fort.501;6;0.0165088822;1710;64;0;0.0441941738;0.0078125;34;11.216374269;1710;6;0.00898;0.00158;0.00205;0.00205;0.00898;0.00158;0.00205;0.00205;0.00672 

我的gnuplot脚本

set datafile separator ";" 
set datafile missing "?" 

set grid 

set xlabel "coarsening level" 

set ylabel "rrmen3a1" 

set xrange [-1:7] 
set yrange [*:*] 

set terminal pdf color 
set output "tmp.pdf" 

plot \ 
"tmp.dat" using 2:21 index 0 with lp title columnheader(1), \ 

# EOF 

不绘制 “第一” 点(0,0.00172) ,只有点x = 1,...,6 任何提示?

+0

第一行是由'title columnheader'消耗的 – Christoph

+0

http://stackoverflow.com/q/283​​46228/2604213 – Christoph

回答

1

的问题是与你的情节

plot "tmp.dat" using 2:21 index 0 with lp title columnheader(1) 

这指示gnuplot的使用您的第一个记录(不包括注释行)作为列标签使用。所以你的第一条数据行被解释为标题。如果您不想重新格式化数据文件,可以使用相同的头文件绘制虚拟曲线,该头文件将充当您的数据系列标签。类似于

plot "tmp.dat" using 2:21  index 0 with lp lt 1 lc rgb 'black' notitle, \ 
    "tmp.dat" using ($0):(1/0) index 0 with lp lt 1 lc rgb 'black' columnhead(1) 

请注意,我们必须手动指定线条样式以确保键具有与曲线相同的线条样式。

+0

谢谢Gavin的详尽解释! –