I have a data file with two columns: Xi and Yi. I’d like to plot Xi vs. (Yi-1 - Yi)/Yi-1 for i>1. Is is possible to do that in GNUPlot direclty?
I have a data file with two columns: Xi and Yi . I’d like
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes it is possible with gnuplot directly — It’s just not easy:
You need to use inline functions. inline functions are of the form:
Here I just created a function to hold the last value it was passed. Unforunately, this solution gets a little more ugly since I couldn’t call
yi1twice in the using specification (the second time, I would get the wrong return value), so I had to reference the variable holding the return value directly. It’s not pretty, but it works. You could probably “pretty” it up a little bit by passing$0(the line number) and only updating when $0 changes, but it’s probably not worth it for this hack.