Reputation: 1273
I am interested in labeling the xtics with strings from a column in a file. The file is written in the following manner:
Index Name Status Value
1 Ver1 with 0.3
2 Ver1 without 0.25
3 Ver2 with 0.35
4 Ver3 with 0.27
The datas shall be plotted with a conditioned plot
plot file u (strcol(3) eq "with"?$1:1/0):($4) w p pt 7 notitle
The xtics shall be labeled with the data contained in column(2). If all values are used this can be done by xticlabel(2)
. But I only want to use the filtered data to get a plot like:
|
| x x x
|
----------------------------
ver1 ver2 ver3
The questions is: How can I label the xtics using only the filtered values?
Thanks in advance!
Upvotes: 0
Views: 255
Reputation: 13097
You could impose the same condition in xticlabel
as well, i.e., to use column 2 if required or pass an undefined value instead:
plot 'file.dat' u \
(strcol(3) eq "with"?$1:1/0):4:xticlabel((strcol(3) eq "with")?strcol(2):1/0) \
w p pt 7 notitle
Upvotes: 2