1

I have an array which has values like:

percentile="P5,P10,P20,P25,P50,P75"

I'm using for loop for iteration in gnuplot, somewhat like this:

plot for [i=2:4] "Stats.data" using (column(1)):(column(i)) title "${percentile[i]}".i

What I want is that the titles to be taken up from the percentile array.But this isn't happening.

ERROR:invalid command

1 Answer 1

3

if percentile is represented as a string in you Gnuplot script, then you might employ the word function which extracts the corresponding white-space delimited word from the supplied string (the word index is 1-based)

percentile="P5 P10 P20 P25 P50 P75"

plot for [i=2:4] "Stats.data" using (column(1)):(column(i)) w l title word(percentile, i+1)
Sign up to request clarification or add additional context in comments.

Comments

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.