I am planning to draw a 2D plot
using gnuplot .
But in this case I want to skip first column of my data.txt
file .
Background of this question is ,I am having two inputs for given output . But I want to draw the graph using one input only ..as I Am using input pattern as FIXED_CONSTANT and random data for ease of drawing .
But How I can skip the first column in my given code in run.gpl
file where the FIXED_CONSTANT is coming as input. I want to use second column as input for drawing my graph..
Can you please suggest me the changes in given code .
my run.gpl
is :
### 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
file :
|--INPUT0--|--INPUT1--|--REF_OUT--|--OPT_OUT--|--ERROR--|
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
And also if possible can you suggest me in your answer for plotting the 3D graph using gnuplot for my given scnerio by considering my current run.gpl
. for 3D Graph, I can change my first column FIXED_CONSTANT value to random generated also .
If I understood the question correctly, you would only have to change the u 1:3
to u 2:3
and so on:
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"
Was that what you're looking for? For a simple 3D plot you could try:
splot 'data.txt' u 2:3:4