在 gnuplot 中绘制图形时如何跳过 COLUMN
How to skip COLUMN while drawing graph in gnuplot
我打算使用 gnuplot 绘制 2D plot
。
但在这种情况下,我想跳过 data.txt
文件的第一列。
这个问题的背景是,对于给定的输出,我有两个输入。
但是我只想使用一个输入来绘制图形。因为我使用输入模式 FIXED_CONSTANT 和随机数据以便于绘制。
但是我如何跳过 run.gpl
文件中给定代码的第一列,其中 FIXED_CONSTANT 作为输入。我想使用第二列作为绘制图形的输入..
能否建议我修改给定代码。
我的 run.gpl
是:
### three curves in one plot with two y-axes
reset session
set terminal png size 1024,768 font ",12"
set output "graph.png"
set xlabel "Input"
set ylabel "output"
set ytics nomirror
set y2label "Error"
set y2tics nomirror
set grid
set key
plot 'data.txt' u 1:3 w p axes x1y1 ti "Ref output" lc rgb "red" , \
'' u 1:4 w p axes x1y1 ti "OPT output" lc rgb "green" , \
'' u 1:5 w p axes x1y2 ti "Error between Ref and OPT output" lc rgb "blue"
set output
### end of code
data.txt
文件:
|--输入0--|--输入1--|--REF_OUT--|--OPT_OUT--|--错误--|
10.000000000000000 36.122192382812500 0.270114153623581 0.270074307918549 0.000039845705032
10.000000000000000 38.702346801757812 0.252882927656174 0.252852171659470 0.000030755996704
10.000000000000000 41.282516479492188 0.237678512930870 0.237655565142632 0.000022947788239
10.000000000000000 43.862670898437500 0.224169462919235 0.224153116345406 0.000016346573830
10.000000000000000 46.442825317382812 0.212091386318207 0.212080582976341 0.000010803341866
10.000000000000000 49.022979736328125 0.201231494545937 0.201225265860558 0.000006228685379
10.000000000000000 51.603134155273438 0.191416561603546 0.191414132714272 0.000002428889275
10.000000000000000 54.183303833007812 0.182504311203957 0.182505041360855 -0.000000730156898
10.000000000000000 56.763458251953125 0.174377039074898 0.174380362033844 -0.000003322958946
10.000000000000000 59.343612670898438 0.166936323046684 0.166941791772842 -0.000005468726158
10.000000000000000 61.923767089843750 0.160099431872368 0.160106644034386 -0.000007212162018
10.000000000000000 64.503936767578125 0.153796255588531 0.153804913163185 -0.000008657574654
10.000000000000000 67.084091186523438 0.147967159748077 0.147977009415627 -0.000009849667549
10.000000000000000 69.664245605468750 0.142560914158821 0.142571732401848 -0.000010818243027
10.000000000000000 72.244400024414062 0.137533426284790 0.137545034289360 -0.000011608004570
10.000000000000000 74.824554443359375 0.132846444845200 0.132858693599701 -0.000012248754501
10.000000000000000 77.404708862304688 0.128466725349426 0.128479465842247 -0.000012740492821
10.000000000000000 79.984878540039062 0.124365106225014 0.124378263950348 -0.000013157725334
10.000000000000000 82.565032958984375 0.120516106486320 0.120529577136040 -0.000013470649719
10.000000000000000 85.145187377929688 0.116897158324718 0.116910874843597 -0.000013716518879
10.000000000000000 87.725357055664062 0.113488301634789 0.113502189517021 -0.000013887882233
10.000000000000000 90.305511474609375 0.110271871089935 0.110285893082619 -0.000014021992683
10.000000000000000 92.885665893554688 0.107232064008713 0.107246160507202 -0.000014096498489
10.000000000000000 95.465820312500000 0.104354768991470 0.104368910193443 -0.000014141201973
10.000000000000000 98.045974731445312 0.101627349853516 0.101641491055489 -0.000014141201973
10.000000000000000 100.626129150390625 0.099038407206535 0.099052540957928 -0.000014133751392
10.000000000000000 103.206283569335938 0.096577703952789 0.096591800451279 -0.000014096498489
10.000000000000000 105.786453247070312 0.094235941767693 0.094249986112118 -0.000014044344425
10.000000000000000 108.366607666015625 0.092004776000977 0.092018745839596 -0.000013969838619
10.000000000000000 110.946762084960938 0.089876532554626 0.089890420436859 -0.000013887882233
而且,如果可能的话,您能否通过考虑我当前的 run.gpl
在您的答案中建议我使用 gnuplot 为我给定的 scnerio 绘制 3D 图形。对于 3D 图形,我可以将我的第一列 FIXED_CONSTANT 值也更改为随机生成。
如果我理解正确的话,你只需要将 u 1:3
更改为 u 2:3
等等:
plot 'data.txt' u 2:3 w p axes x1y1 ti "Ref output" lc rgb "red" , \
'' u 2:4 w p axes x1y1 ti "OPT output" lc rgb "green" , \
'' u 2:5 w p axes x1y2 ti "Error between Ref and OPT output" lc rgb "blue"
这就是您要找的吗?对于简单的 3D 图,您可以尝试:
splot 'data.txt' u 2:3:4
我打算使用 gnuplot 绘制 2D plot
。
但在这种情况下,我想跳过 data.txt
文件的第一列。
这个问题的背景是,对于给定的输出,我有两个输入。 但是我只想使用一个输入来绘制图形。因为我使用输入模式 FIXED_CONSTANT 和随机数据以便于绘制。
但是我如何跳过 run.gpl
文件中给定代码的第一列,其中 FIXED_CONSTANT 作为输入。我想使用第二列作为绘制图形的输入..
能否建议我修改给定代码。
我的 run.gpl
是:
### three curves in one plot with two y-axes
reset session
set terminal png size 1024,768 font ",12"
set output "graph.png"
set xlabel "Input"
set ylabel "output"
set ytics nomirror
set y2label "Error"
set y2tics nomirror
set grid
set key
plot 'data.txt' u 1:3 w p axes x1y1 ti "Ref output" lc rgb "red" , \
'' u 1:4 w p axes x1y1 ti "OPT output" lc rgb "green" , \
'' u 1:5 w p axes x1y2 ti "Error between Ref and OPT output" lc rgb "blue"
set output
### end of code
data.txt
文件:
|--输入0--|--输入1--|--REF_OUT--|--OPT_OUT--|--错误--|
10.000000000000000 36.122192382812500 0.270114153623581 0.270074307918549 0.000039845705032
10.000000000000000 38.702346801757812 0.252882927656174 0.252852171659470 0.000030755996704
10.000000000000000 41.282516479492188 0.237678512930870 0.237655565142632 0.000022947788239
10.000000000000000 43.862670898437500 0.224169462919235 0.224153116345406 0.000016346573830
10.000000000000000 46.442825317382812 0.212091386318207 0.212080582976341 0.000010803341866
10.000000000000000 49.022979736328125 0.201231494545937 0.201225265860558 0.000006228685379
10.000000000000000 51.603134155273438 0.191416561603546 0.191414132714272 0.000002428889275
10.000000000000000 54.183303833007812 0.182504311203957 0.182505041360855 -0.000000730156898
10.000000000000000 56.763458251953125 0.174377039074898 0.174380362033844 -0.000003322958946
10.000000000000000 59.343612670898438 0.166936323046684 0.166941791772842 -0.000005468726158
10.000000000000000 61.923767089843750 0.160099431872368 0.160106644034386 -0.000007212162018
10.000000000000000 64.503936767578125 0.153796255588531 0.153804913163185 -0.000008657574654
10.000000000000000 67.084091186523438 0.147967159748077 0.147977009415627 -0.000009849667549
10.000000000000000 69.664245605468750 0.142560914158821 0.142571732401848 -0.000010818243027
10.000000000000000 72.244400024414062 0.137533426284790 0.137545034289360 -0.000011608004570
10.000000000000000 74.824554443359375 0.132846444845200 0.132858693599701 -0.000012248754501
10.000000000000000 77.404708862304688 0.128466725349426 0.128479465842247 -0.000012740492821
10.000000000000000 79.984878540039062 0.124365106225014 0.124378263950348 -0.000013157725334
10.000000000000000 82.565032958984375 0.120516106486320 0.120529577136040 -0.000013470649719
10.000000000000000 85.145187377929688 0.116897158324718 0.116910874843597 -0.000013716518879
10.000000000000000 87.725357055664062 0.113488301634789 0.113502189517021 -0.000013887882233
10.000000000000000 90.305511474609375 0.110271871089935 0.110285893082619 -0.000014021992683
10.000000000000000 92.885665893554688 0.107232064008713 0.107246160507202 -0.000014096498489
10.000000000000000 95.465820312500000 0.104354768991470 0.104368910193443 -0.000014141201973
10.000000000000000 98.045974731445312 0.101627349853516 0.101641491055489 -0.000014141201973
10.000000000000000 100.626129150390625 0.099038407206535 0.099052540957928 -0.000014133751392
10.000000000000000 103.206283569335938 0.096577703952789 0.096591800451279 -0.000014096498489
10.000000000000000 105.786453247070312 0.094235941767693 0.094249986112118 -0.000014044344425
10.000000000000000 108.366607666015625 0.092004776000977 0.092018745839596 -0.000013969838619
10.000000000000000 110.946762084960938 0.089876532554626 0.089890420436859 -0.000013887882233
而且,如果可能的话,您能否通过考虑我当前的 run.gpl
在您的答案中建议我使用 gnuplot 为我给定的 scnerio 绘制 3D 图形。对于 3D 图形,我可以将我的第一列 FIXED_CONSTANT 值也更改为随机生成。
如果我理解正确的话,你只需要将 u 1:3
更改为 u 2:3
等等:
plot 'data.txt' u 2:3 w p axes x1y1 ti "Ref output" lc rgb "red" , \
'' u 2:4 w p axes x1y1 ti "OPT output" lc rgb "green" , \
'' u 2:5 w p axes x1y2 ti "Error between Ref and OPT output" lc rgb "blue"
这就是您要找的吗?对于简单的 3D 图,您可以尝试:
splot 'data.txt' u 2:3:4