0

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!

1 Answer 1

2

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
Sign up to request clarification or add additional context in comments.

1 Comment

Very well. Thanks a lot!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.