Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8826379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:07:16+00:00 2026-06-14T07:07:16+00:00

I have a data file with two columns: Xi and Yi . I’d like

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T07:07:18+00:00Added an answer on June 14, 2026 at 7:07 am

    Yes it is possible with gnuplot directly — It’s just not easy:

    firstval = NaN
    yi1(yi) = (returnval=firstval, firstval=yi, returnval)
    plot "datafile" using 1:((yi1($2)-$2)/returnval)
    

    You need to use inline functions. inline functions are of the form:

    funcname(args,...) = (statement1,statement2,...,statementn, return_value)
    

    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 yi1 twice 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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the file data.txt with two columns and N rows, something like this:
I have C++ program that now generates two files: data file (with columns of
I have a data file that looks like this: xyz123 2.000 -0.3974 0.0 hij123
I have a data file that looks like the following example. I've added '%'
I have a file that has two columns of floating point values. I also
I have a Flat File Source that reads data from a file with two
I have a postgres function that returns two columns result, data (int), (text) If
Suppose I have a file with two columns of data file.dat . I would
I have a .dat file that contains two columns of numbers so it looks
I have an NSTableView with two columns and a data source that fills it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.