Search code examples
gnuplotgraphing

How to plot two lines with data in GNUplot


I have a data file to be fitted to a scatterplot in .txt format with simple x,y data.

I also have two lines that I want to overlay on the data:

Line 1: y= -0.2232589739194248 * x + 4.381190125671611

Line 2: y= 5.517500395590605 + -0.8442345203102343 * x + 0.07974732479342203 * x*x

I can plot each of these separately using the plot function, but how do I get them to all appear together?


Solution

  • Just use

    set style func lines
    plot 'file.txt' with points,\
         -0.2232589739194248 * x + 4.381190125671611,\
         5.517500395590605 + -0.8442345203102343 * x + 0.07974732479342203 * x*x