Agung
Agung

Reputation: 13

Gnuplot: how to make gnuplot keep counting the blank column?

I am trying to draw the decay scheme level using the data below:

xl  E      elabel    Xa   E1    Xa   E2
1   500     0       5.2 321.32  5.2 249.67          
3   500     0       5.5 321.32  5.5 112.95  
5   321.32  0       5.8 321.32  5.8 0
8.5 321.32  321.32  
5   249.67  0       6.2 249.67  6.2 112.96
8.5 249.67  249.67  
5   112.95 
8.5 112.95  112.95
5   0
8.5 0   0

I plot (gnuplot v 5.2) the data using this:

plot 'decay.txt'u 1:2 w l lc rgb 'black',\                            
     ''u 1:2:3 w labels right offset 0,0.8,                                
     ''u 4:5:($6-$4):($7-$5) w vec

The result is almost as what i wanted:

decay.png

except one thing, the 0 label on the upper left of horizontal line should be removed. I tried to remove the 0 value from the elabel column of the data (ex: col: elabel, line 1, 3, and 5) just like in line 7 (112.95 level), but then it will not produce the arrows as gnu will read the Xa column as 3rd column rather than 4th.

Is there anyway to make gnuplot keep count the column even though there is no data in the column?

Upvotes: 1

Views: 134

Answers (1)

theozh
theozh

Reputation: 25692

In order to get the same (or similar) result (tested in guplot 5.2.5), i.e. the different levels not connected with lines, I need to introduce empty lines in the data.

Taking your data (the columns of the data below are separated by TABs):

# decay.txt
xl  E   elabel  Xa  E1  Xa  E2
1   500     5.2 321.32  5.2 249.67
3   500     5.5 321.32  5.5 112.95

5   321.32      5.8 321.32  5.8 0
8.5 321.32  321.32  

5   249.67      6.2 249.67  6.2 112.96
8.5 249.67  249.67  

5   112.95  
8.5 112.95  112.95

5   0
8.5 0   0
# end of data

and the following code:

# start code
reset session
set datafile separator "\t"
set yrange[0:600]
plot 'decay.txt' u 1:2 w l lc rgb 'black',\
     '' u 1:2:3 w labels right offset 0,0.8,\
     '' u 4:5:($6-$4):($7-$5) w vec
# end of code

results in something like:

enter image description here

Upvotes: 1

Related Questions