Find the answer to your Linux question:
Results 1 to 3 of 3
I don't know if this is the correct place for this, but I wanted to graph in gnuplot one column of a data file using the formula y=mx+b... where m ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    LRG
    LRG is offline
    Just Joined!
    Join Date
    Jun 2009
    Location
    New York
    Posts
    12

    plotting a data file in ginuplot in linux


    I don't know if this is the correct place for this, but I wanted to graph in gnuplot one column of a data file using the formula y=mx+b... where m is a constant and b is a constant...x is the data and y is unknown. I known how to move that one column of data to its own file and that's what I have done. I need a code for the mx+b graph though...I obviously know how to apply that formula but I don't know how to make gnuplot do it for a very large number of data point (x). Please help

    Because I did not know how to make a line like that with many x values in gnuplot, I just found 2 points by solving for two specifc x's...this did work but once I graphed the line I could not figure out how to extend the line further than those two points...

    ~So if it is possible to extend the line of thosetwo points then what is the code? ... would doing a best fit line for those two points give me the line for all of those data points? If so...how do I do that?
    ~If not, then what is the code to just graph all of those data points for x?

    Any suggestions are appreciated.

    Thanks

  2. #2
    Linux Guru Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,252
    So you basically have a column of data (which we will call x) and you want to plot coordinates by using that x and a y which is a formula?

    I suspect this will work:
    Code:
    plot "datafile.dat" using 1:(m * $1 + b)
    You will obviously need to fill in m and b.

    This works by telling plot which columns to use. Here we say that the first column will be used for the x value, and the expression that we have given will be used for the y value. In that expression, $1 refers to the first column of the datafile.

    I hope this helps! You can learn more at:
    Using

  3. #3
    LRG
    LRG is offline
    Just Joined!
    Join Date
    Jun 2009
    Location
    New York
    Posts
    12
    Thankyou SO much, it did work, I've been trying to figure it out forever..

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •