I use the following gnuplot commands to create a graph:
#!/bin/bash gnuplot << 'EOF' set term postscript portrait color enhanced set output 'out.ps' plot 'data_file' u 3:2 w points , '' u 3:2:($4!=-3.60 ? $1:'aaa') w labels EOF
where data_file as follows:
O4 -1.20 -0.33 -5.20 O9.5 -1.10 -0.30 -3.60 B0 -1.08 -0.30 -3.25 B0.5 -1.00 -0.28 -2.60 B1.5 -0.90 -0.25 -2.10 B2.5 -0.80 -0.22 -1.50 B3 -0.69 -0.20 -1.10
I want gnuplot to put all labels on the rows found in column 1 except where column 4 is -3.60 in which I want the line aaa . I get that the data point $4=-3.60 correctly marked as aaa , but the rest are not marked as at all .
Refresh . Gnuplot has no problem displaying numbers as labels using a conditional operator, i.e. any column, but 1 correctly displayed as a label for each point, conditions imposed. That is, this row displays column 2 (numbres) as point labels corresponding to the conditional expression:
plot 'data_file' u 3:2 w points , '' u 3:2:($4!=-3.60 ? $2:'aaa') w labels
Update 2 . It also has no problem constructing column 1 as point labels if I draw it as a whole , that is, without using strong> conditional statement. That is, this row correctly draws all the dot labels in column 1 (rows):
plot 'data_file' u 3:2 w points , '' u 3:2:1 w labels
So itβs clear that the problem is using the conditional operator along with the row column. Any of them used separately works fine.
Gabriel
source share