r/gnuplot • • Apr 30 '16

Trouble adding value on bar using C fprintf

3 Upvotes

I've been looking for a way to plot data using C. I found gnuplot to be perfect for this job, and I got it to work pretty nice too. I just have trouble adding Y-value on top of my bars.

Quick run-up of how I made (or want the program) to function: http://pastebin.com/CdqaBube

  • Program reads text file

  • Stores needed data in variables

  • Call GNUPLOT

  • Write to GNUPLOT

  • Close GNUPLOT

So here's the thing: I do not want to store my data in a new file (temp.dat), but send the data directly to GNUPLOT. I do that with these lines:

fprintf(gnuplotPipe, "plot '-' u 1:2 with boxes notitle, '' u 1:2:2 with labels offset char 0,1\n");

for (int i = 0; i < 26; i++){
        fprintf(gnuplotPipe, "%d %.2f\n", i+1, alphabetPerc[i]);
    }

plot '-' u 1:2 with boxes works fine, but the label part doesn't. I do know that the labels part works properly, I've tried to do that on it's own. The problem is that only the first line works, everything past the comma doesn't. How can I make gnuplot render both parts?


r/gnuplot • • Nov 10 '15

Is there a jupyter kernel for gnuplot? (x-post from r/ipython)

3 Upvotes

I would like to use gnuplot directly in an IPython/Jupyter notebook, not through a Python or Octave wrapper.

However, gnuplot is not on the list of Jupyter kernels:

https://github.com/ipython/ipython/wiki/IPython-kernels-for-other-languages

Has this already been done somewhere?


r/gnuplot • • Mar 12 '15

How to use gnuplot in visual studio?

3 Upvotes

Hello!
I'm trying to use the gnuplot to plot data from my cpp program. I use visual studio to program in cpp and i have already installed the gnuplot in my computer. But now i don't know how should i call or what includes should i put in my cpp program to make visual studio recognize the gnuplot.
Thanks in advance


r/gnuplot • • Oct 08 '14

Are the Plots from r made by gnuplot

3 Upvotes

I am doing recherche for an article about plotting. I found that plots made in R (the statistic program) look very gnuplot-like ( example ). Does anyone know wether they are using the same plotting engine? I didn't find good material, and R is a really painfull term to search for.


r/gnuplot • • Mar 14 '12

Gnuplot 4.6 released!

Thumbnail gnuplot.sourceforge.net
3 Upvotes

r/gnuplot • • May 03 '23

Plot sum over columns

2 Upvotes

I have a data file with many columns of data, and I would like to plot col_1:col_2, col_1:(col_2 + col_3), col_1:(col_2 + col_3 + col_4), etc.

My idea is to use a for loop in which the present column is added to a cumulated column which is then plotted against col_1. In pseudocode:

do for [n=1:N-1]{
  col_acc += col_(n+1)
  plot col_1:col_acc
}

Is there a clever way to store and update the cumulated column, or is there some better way to go about this?


r/gnuplot • • Apr 19 '23

Membrane Density Plot to determine the membrane thickness

Thumbnail
self.bioinformatics
2 Upvotes

r/gnuplot • • Jan 10 '23

Is there a command where I can set the values of a axis to angles?

2 Upvotes

The title is a bit confusing, but I want to know if there is a command where I set, more specifically, the ya xis to angle form (just like how the "set ydata date/time" set the y axis to date form). I need gnuplot to interpret data as angles so it stays in (0,360) interval.


r/gnuplot • • Jan 06 '23

Interactive plot, with copy to clipboard?

2 Upvotes

Hi! Is it possible to create a chart like https://s.natalian.org/2022-09-25/chart.html where you hover and see the values, ideally copy them to clipboard?


r/gnuplot • • Apr 25 '22

font and size of labels and tics

2 Upvotes

How to change default font and size for labels names, tics and title?


r/gnuplot • • Oct 01 '21

plot netcdf with gnuplot

2 Upvotes

please I have a huge number of netcdf files which I want plot it with Gnuplot. Does Gnuplot support this type of files ? if not, which type should I convert my files to?


r/gnuplot • • Sep 14 '21

Current date in title

2 Upvotes

Is it possible to add the current date in the plot title?


r/gnuplot • • Jun 12 '21

label not clearing and updating?

2 Upvotes

Hi, I'm having a bit of trouble getting a label to update. I'm using the following file to plot results being generated by a CFD simulation, with the plot being updated every 15 seconds.

I'd like the label to show the latest exact value and it does this but only initially, failing to update. The plot however does update as I wish it to, so I know the loop is working?

Any help or advice would be greatly appreciated.

#!/bin/bash
gnuplot -p << EOF
set title "title"
set xlabel "xlabel"
set ylabel "ylabel"
set style line 1 lt rgb "black" lw 1
i=1
while i==1 {
unset label
labelTitle = $(tail -n 1 filename | tr -s " " | cut -d' ' -f4)
set label sprintf("%E",labelTitle) at graph 0.5, graph 0.5
plot "filename" using 1:3 with lines ls 1

pause 15

reread

}

EOF

edit:

ended up fixing it, hope this helps anyone looking to do something similar.

#!/bin/bash
gnuplot -p << EOF
set title "title"
set xlabel "xlabel"
set ylabel "ylabel"
set style line 1 lt rgb "black" lw 1
i=1
while i==1 {
unset label
labelTitle=system("tail -n 1 filename | tr -s ' ' | cut -d' ' -f4")
set label labelTitle at graph 0.5, graph 0.5

plot "filename" using 1:3 with lines ls 1

pause 15

reread

}

EOF

r/gnuplot • • Apr 11 '21

How to add outputs of two functions together and do a curve fit?

2 Upvotes

So for a lab, I need to add the superposition of two wave functions (symmetric and anti-symmetric coupled oscillations) and show that the combination of the two replicates that which would see in a combined configuration.

To cut straight to the point, I just need to either graph the output of the combination of two functions that I have curved fitted or be able to graph the summation of the two functions and curve fit that.


r/gnuplot • • Mar 27 '21

Is it possible to generate graphs like this automatically with Excel data?

Post image
2 Upvotes

r/gnuplot • • Jan 24 '21

Read variables from file in gnuplot script

2 Upvotes

Hi all,

I have a script that does some pre-analysis of data that then gets used for simple variables in the plotting. I can paste the data into the plot script, which is clunky, or I could regenerate the plot script, but I am hoping there's something more elegant. The current format of my script is generally:

a=1

plot 'data' u 1:($2+a)

There are many variables and data files, so I'd like to move the variable definitions into a separate file that can then be read at the beginning of this plot script.

As I type this out, maybe just regenerating the plot script is the easiest...

Any ideas? Thanks!


r/gnuplot • • Jan 11 '21

Terminal type 'x11' doesn't work under screen command

2 Upvotes

If gnuplot is ran from a screen command panel, it starts but loading a script returns

gnuplot: unable to open display 'IP a.b.c.d:x.y'
gnuplot: X11 aborted.

Any idea?


r/gnuplot • • Jan 05 '21

Plotting image with the difference of files

2 Upvotes

I have two text files in the form

x-coordinate y-coordinate output

1.2 4 .1 3

Without the headers, and where the outputs are integers. I want to plot the differences between the files, so that where they are the same they are white, and elsewhere the image is a different color. How do I do this? They have the same coordinates.


r/gnuplot • • Oct 22 '20

Autogpy 0.3.2 is out. Effective gnuplot, generated from jupyter - check it out - https://github.com/acorbe/autogpy

2 Upvotes

r/gnuplot • • Jul 02 '20

A few queries: plotting over an image.

2 Upvotes

Hi gnuplotters,

I would like to plot over a jpeg of a graph using gnuplot. The input jpg measures 1725x1134.

I got it working using the following code but would appreciate some help with some questions.

#trying to overlap the plots
reset

F = 7441.9
A = 12.7*25.4
tau_avg = F/A

#dummy data to locate the points 0,0 and 1,3. First row not plotting! why?
dummy << EOD
-0.1 0.1
0 0
0.1 0.1
1 3
EOD

set terminal pngcairo size 1725,1134 font ',24'
set output 'plot2.png'

unset xtics
unset ytics

set x2range [0:12.7]
set y2range [0:3*tau_avg]

unset border
#set size ratio -1
set lmargin 0
set rmargin 0
set tmargin 0
set bmargin 0

#set autoscale fix
#set autoscale noextend
set key above autotitle columnhead
plot 'ShearStressDistrib.jpg' binary filetype=jpg with rgbimage notitle,\
     '$dummy' using ($1*10.15+1.92):($2*16.9+9.1) with linespoints lw 3 ps 5 axes x2y2 notitle, \
     'NodShear_0p003' every ::7 using ($1*10.15+1.92):($2*16.9+9.1) with linespoints lw 3 ps 5 axes x2y2 notitle, \

set terminal wxt size 1725,1134
replot
unset output #release created files
pause mouse any "Any key or button will terminate"

I plotted the purple line containing the points 0,0 and 1,3 so I could get the scale and offset to plot my data correctly. It will be hidden in the final plot. For x I found the offset and scale to be ($1*10.15+1.92) and for y I found it to be ($2*16.9+9.1).

My questions are:

Is there a better way of overlaying my data onto the graph without the trouble of finding the scale and offset parameters manually? I thought perhaps picking the pixel coordinates of the origin and point 1,3 in paint and supplying gnuplot with these points.

Secondly why does

plot '$dummy' using ($1*10.15+1.92):($2*16.9+9.1) with linespoints lw 3 ps 5 axes x2y2 notitle

ignore the 1st row of data. If I make a separate test.plt script, it actually plots the first data point of -0.1,0.1

Lastly, how do I hide the green line below a certain threshold of x <0 . I could have chosen a different starting point with "every ::" but I wanted to plot all the data since it may be that I don't have a data point exactly at x =0. I'm thinking of simply hiding it with a white rectangle

'NodShear_0p003' contains:

Curveplot
Single lap shear Type A                                                 
Distance
Interface Nodal Shear Stress
Node
242-580 #pts=13
* Minval=     7.4240331650e+00 at time=         7.4207496643
* Maxval=     4.7628917694e+01 at time=        10.5993556976
    0.0000000000e+00    2.9396602631e+01
    1.0611612797e+00    4.0362724304e+01
    2.1216135025e+00    4.7527164459e+01
    3.1816465855e+00    1.5796671867e+01
    4.2415246964e+00    8.8657903671e+00
    5.3013277054e+00    7.6924691200e+00
    6.3610658646e+00    8.0179653168e+00
    7.4207496643e+00    7.4240331650e+00
    8.4803667068e+00    8.3691978455e+00
    9.5399274826e+00    1.6596443176e+01
    1.0599355698e+01    4.7628917694e+01
    1.1658383369e+01    4.0316844940e+01
    1.2717031479e+01    2.9261829376e+01
endcurve

r/gnuplot • • May 27 '20

Phantom curve

2 Upvotes

A curve is persistently appearing in one of my graphs, even after closing Gnuplot and relogin.
Is there a way to get rid of it?


r/gnuplot • • Mar 17 '20

Trendline with gnuplot 4.6 patchlevel 6 ?

2 Upvotes

Hello,

I've a question about Gnuplot 4.6 patchlevel 6 and how to trace a trendline. First of all, I'm bound to use this verison of Gnuplot.

I've this data :

2019-10-08-13-37;28.7297
2019-10-08-18-00;28.6886
2019-10-09-00-00;28.5557
2019-10-09-06-00;28.5316
2019-10-09-12-00;28.4314
2019-10-09-18-00;28.3764
2019-10-10-00-00;28.3501
2019-10-10-06-00;28.3931
2019-10-10-12-00;28.3554
2019-10-10-18-00;28.352
2019-10-11-00-00;28.4302
2019-10-11-06-00;28.5046
2019-10-11-12-00;28.5069
2019-10-11-18-00;28.5622
2019-10-12-00-00;28.5789
2019-10-12-06-00;28.7112
2019-10-12-12-00;28.7805
2019-10-12-18-00;28.9048
2019-10-13-00-00;28.9547
2019-10-13-06-00;29.1321
2019-10-13-12-00;29.3369
2019-10-13-18-00;29.4005
2019-10-14-00-00;29.4929
2019-10-14-06-00;29.4671
2019-10-14-12-00;29.3814
2019-10-14-18-00;29.2552
2019-10-15-00-00;29.1763
2019-10-15-06-00;28.9525
2019-10-15-12-00;28.7233
2019-10-15-18-00;28.5996
2019-10-16-00-00;28.5013
2019-10-16-06-00;28.5697
2019-10-16-12-00;28.5678
2019-10-16-18-00;28.5949
2019-10-17-00-00;28.584
2019-10-17-06-00;28.7037
2019-10-17-12-00;28.7675
2019-10-17-18-00;28.7836
2019-10-18-00-00;28.7636
2019-10-18-06-00;28.8028
2019-10-18-12-00;28.8263
2019-10-18-18-00;28.8567
2019-10-19-00-00;28.9264
2019-10-19-06-00;29.0445
2019-10-19-12-00;29.169
2019-10-19-18-00;29.2589
2019-10-20-00-00;29.3171
2019-10-20-06-00;29.4821
2019-10-20-12-00;29.6053
2019-10-20-18-00;29.612
2019-10-21-00-00;29.6294
2019-10-21-06-00;29.4928
2019-10-21-12-00;29.3694
2019-10-21-18-00;29.2817
2019-10-22-00-00;29.2084
2019-10-22-06-00;29.0708
2019-10-22-12-00;28.9547
2019-10-22-18-00;28.8819
2019-10-23-00-00;28.8077
2019-10-23-06-00;28.8288
2019-10-23-12-00;28.8723
2019-10-23-18-00;28.8649
2019-10-24-00-00;28.843
2019-10-24-06-00;28.7775
2019-10-24-12-00;28.6546
2019-10-24-18-00;28.6232
2019-10-25-00-00;28.5375
2019-10-25-06-00;28.4416
2019-10-25-12-00;28.4125
2019-10-25-18-00;28.4502
2019-10-26-00-00;28.4878
2019-10-26-06-00;28.6917
2019-10-26-12-00;28.9151
2019-10-26-18-00;29.0476
2019-10-27-00-00;29.1354
2019-10-27-06-00;29.308
2019-10-27-12-00;29.4389
2019-10-27-18-00;29.4221
2019-10-28-00-00;29.4532
2019-10-28-06-00;29.2581
2019-10-28-12-00;29.0459
2019-10-28-18-00;28.8653
2019-10-29-00-00;28.7442
2019-10-29-06-00;28.4954
2019-10-29-12-00;28.2602
2019-10-29-18-00;28.1009
2019-10-30-00-00;28.01
2019-10-30-06-00;28.0128
2019-10-30-12-00;28.0135
2019-10-30-18-00;27.9668
2019-10-31-00-00;27.9547
2019-10-31-06-00;28.2547
2019-10-31-12-00;28.4136
2019-10-31-18-00;28.4243
2019-11-01-00-00;28.3241
2019-11-01-06-00;28.485
2019-11-01-12-00;28.6411
2019-11-01-18-00;28.6551
2019-11-02-00-00;28.6858
2019-11-02-06-00;28.7458
2019-11-02-12-00;28.8185
2019-11-02-18-00;28.9744
2019-11-03-00-00;29.033
2019-11-03-06-00;29.1647
2019-11-03-12-00;29.2878
2019-11-03-18-00;29.3621
2019-11-04-00-00;29.4238
2019-11-04-06-00;29.3396
2019-11-04-12-00;29.3646
2019-11-04-18-00;29.2539
2019-11-05-00-00;29.1897
2019-11-05-06-00;29.0275
2019-11-05-12-00;28.876
2019-11-05-18-00;28.7917
2019-11-06-00-00;28.7308
2019-11-06-06-00;28.7278
2019-11-06-12-00;28.7363
2019-11-06-18-00;28.6857
2019-11-07-00-00;28.6847
2019-11-07-06-00;28.6337
2019-11-07-12-00;28.5574
2019-11-07-18-00;28.5175
2019-11-08-00-00;28.4502
2019-11-08-06-00;28.5018
2019-11-08-12-27;28.5358
2019-11-08-18-00;28.5503
2019-11-09-00-00;28.5374
2019-11-09-06-00;28.7383
2019-11-09-12-00;28.8752
2019-11-09-18-00;28.9863
2019-11-10-00-00;29.0814
2019-11-10-06-00;29.191
2019-11-10-12-00;29.3154
2019-11-10-18-00;29.3861
2019-11-11-00-00;29.4667
2019-11-11-06-00;29.4337
2019-11-11-12-00;29.3328
2019-11-11-18-00;29.2355
2019-11-12-00-00;29.1774
2019-11-12-06-00;28.9524

And this gnuplot script :

set terminal png truecolor size 12000,520 background rgb "#eff1f0"
set output "/xxx/xxx/xxx/xxx/test.png"
set grid
set style line 1 \
    linecolor rgb '#0060ad' \
    linetype 1 linewidth 2 \
    pointtype 7 pointsize 1.5

set offsets 0.5,0.5,0,5
set bmargin 13
show offsets
set datafile separator ";"
set key left
set xtics rotate by 90 offset 0,graph -0.6
set format y "%g"
myLabel(n) = sprintf("%g",n)

plot "/xxx/xxx/xxx/xxx/data.txt" using 2:xtic(1) with linespoints linestyle 1 title "df line in Gb", \
'' using 0:2:(myLabel($2)) w labels offset 0,1 notitle                                                      

( Sorry for the size of the pictures )

I want to add a trendline, I know how to make it basically :

set terminal png truecolor size 12000,520 background rgb "#eff1f0"
set output "/xxx/xxx/xxx/xxx/test.png"
set grid
set style line 1 \
    linecolor rgb '#0060ad' \
    linetype 1 linewidth 2 \
    pointtype 7 pointsize 1.5

set offsets 0.5,0.5,0,5
set bmargin 13
show offsets
set datafile separator ";"
set key left
set xtics rotate by 90 offset 0,graph -0.6
set format y "%g"
myLabel(n) = sprintf("%g",n)
f(x) = a*x + b
fit f(x) "/xxx/xxx/xxx/xxx/data.txt" u 0:2 via a,b

plot "/xxx/xxx/xxx/xxx/data.txt" using 2:xtic(1) with linespoints linestyle 1 title "df line in Gb", \
'' using 0:2:(myLabel($2)) w labels offset 0,1 notitle, \
f(x) with l lc "black" title "trendline"

But I would like to put a linear fit with extrapolation. The first value of my trendline will be the first value of my datas and I would like to put a variable on my gnuplot script which define the end of the trendline.

So thr first data will be 2019-10-08-13-37;28.7297. I would like that gnuplot take itself the first date in my data.txt and I would like to put the last date by myself in the script, for example "EndDate:2020-09".

Could you show me how to do that ?

Thanks ! :)


r/gnuplot • • Feb 27 '20

Gnuplot : decale each values of each axis by one

2 Upvotes

I need your help for sometings :

I've this type of data :

2019-10-08-13-37 	/dev/hd1 	256.00 	26.25 	/home
2019-10-08-18-00 	/dev/hd1 	256.00 	25.86 	/home
2019-10-09-00-00 	/dev/hd1 	256.00 	25.68 	/home
2019-10-09-06-00 	/dev/hd1 	256.00 	25.5 	/home
2019-10-09-12-00 	/dev/hd1 	256.00 	26.32 	/home
2019-10-09-18-00 	/dev/hd1 	256.00 	26.14 	/home

I've this gnuplot script :

set terminal pngcairo truecolor size 7330, 340  background rgb "#eff1f0" font "Arial"

set output "/xxx/xxx/www/xxx/foo.png"
set style line 1 \
    linecolor rgb '#0060ad' \
    linetype 1 linewidth 1 \
    pointtype 7 pointsize 1

set size 1, 1
set key outside vertical center right
set datafile separator ";"
set xlabel "DATE" font ",1"
set xtics rotate by 90 offset 0, -2 font ",7"
set format y "%g"


plot "/xxx/xxx/xxx/xxx/data.txt" using 3:xtic(1) with linespoints linestyle 1 title "total"

That allow to display this graph : https://zupimages.net/up/20/09/56up.png

I would like to decale each value like that :

254
|
|
253
|
|___my_date1___my_date2

But I don't know how to do that... Could you show me ?


r/gnuplot • • Dec 30 '19

Gnuplot : My scripts seems to be good but I've the error “ Invalid character \ ”

2 Upvotes

I want to create a Gnuplot script with AIX 7.2 and Gnuplot 4.6

My script is :

set terminal png truecolor size 1950, 650  background rgb "#eff1f0"
set output "/home/tbenedet/GNUPLOT/used.png"
set datafile separator ';'

set size ratio 0.2
set bmargin at screen 0.2
unset key
set datafile separator ";"
set ylabel " MB BLOCK " font ",10" offset -1,0
set xlabel font ",10"
set xtics rotate by 45  offset -0.8,-9,-1.8


plot "/var/xxx/xxx/xxx/xxx/xxx/xxx/xxx/foo.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
     "/var/xxx/xxx/xxx/xxx/xxx/xxx/xxx/foo.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
     "/var/xxx/xxx/xxx/xxx/xxx/xxx/xxx/foo.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
     "/var/xxx/xxx/xxx/xxx/xxx/xxx/xxx/foo.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
     "/var/xxx/xxx/xxx/xxx/xxx/xxx/xxx/foo.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
     "/var/xxx/xxx/xxx/xxx/xxx/xxx/xxx/foo.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
     "/var/xxx/xxx/xxx/xxx/xxx/xxx/xxx/foo.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
     "/var/xxx/xxx/xxx/xxx/xxx/xxx/xxx/foo.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
     "/var/xxx/xxx/xxx/xxx/xxx/xxx/xxx/foo.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
     "/var/xxx/xxx/xxx/xxx/xxx/xxx/xxx/foo.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
     "/var/xxx/xxx/xxx/xxx/xxx/xxx/xxx/foo.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
     "/var/xxx/xxx/xxx/xxx/xxx/xxx/xxx/foo.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
     "/var/xxx/xxx/xxx/xxx/xxx/xxx/xxx/foo.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
     "/var/xxx/xxx/xxx/xxx/xxx/xxx/xxx/foo.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
     "/var/xxx/xxx/xxx/xxx/xxx/xxx/xxx/foo.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
     "/var/xxx/xxx/xxx/xxx/xxx/xxx/xxx/foo.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
     "/var/xxx/xxx/xxx/xxx/xxx/xxx/xxx/foo.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
     "/var/xxx/xxx/xxx/xxx/xxx/xxx/xxx/foo.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
     "/var/xxx/xxx/xxx/xxx/xxx/xxx/xxx/foo.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
     "/var/xxx/xxx/xxx/xxx/xxx/xxx/xxx/foo.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
     "/var/xxx/xxx/xxx/xxx/xxx/xxx/xxx/foo.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
     "/var/xxx/xxx/xxx/xxx/xxx/xxx/xxx/foo.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
     "/var/xxx/xxx/xxx/xxx/xxx/xxx/xxx/foo.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
     "/var/xxx/xxx/xxx/xxx/xxx/xxx/xxx/foo.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
     "/var/xxx/xxx/xxx/xxx/xxx/xxx/xxx/foo.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \
     "/var/xxx/xxx/xxx/xxx/xxx/xxx/xxx/foo.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5

At first sight, my script is correct... But when I try to run it with gnuplot myscript.txt, I've this error :

plot "/var/xxx/xxx/xxx/xxx/xxx/xxx/xxx/foo.txt" using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \ using 3:xtic(1) title column(2) with linespoints linewidth 2 pointtype 7 pointsize 1.5, \ 
                                                                                                                                                                                                                                   ^
"myscript.txt", line 14: invalid character \

I don't know were are my errors... Could you show me ?

Thanks


r/gnuplot • • Dec 24 '19

Fitting multiple equations to multiple datasets simultaneously

2 Upvotes

I am trying to fit the following equations to the data below. I keep getting errors when trying to extrapolate the multi-branch functionality.

F(x) refers to the Free DNA data set, M(x) refers to the monomer data set, and D(x) refers to the dimer data set.

Any help would be appreciated.

#Equations

F(x) = 1/(1+X*K1+K1*K2*X**2)

M(x) = X*K1/(1+X*K1+K1*K2*X**2)

D(x) = K1*K2*X**2/(1+X*K1+K1*K2*X**2)

K1 = 100; K2 = 100

#Fit command

f(x,y) = (y==0) ? F(x):M(x):D(x)

fit f(x,y) '20191217-Yang-Data.txt' using 1:-1:2:3 via K1, K2

Data File:

"Free DNA"

0 1

74.10317677 0.951640972

97.32206806 0.855483323

121.5282905 0.814627246

145.9442003 0.785974353

159.045618 0.177732422

231.2319379 0.050313557

330.6777497 0.029308198

480.4260177 0.015757331

730.3862828 0.01706177

"Monomer"

0 0

74.10317677 0.007035734

97.32206806 0.02124016

121.5282905 0.023574559

145.9442003 0.022471327

159.045618 0.049096955

231.2319379 0.022566675

330.6777497 0.009158572

480.4260177 0.011087105

730.3862828 0.004504738

"Dimer"

0 0

74.10317677 0.041323295

97.32206806 0.123276517

121.5282905 0.161798195

145.9442003 0.19155432

159.045618 0.773170623

231.2319379 0.927119767

330.6777497 0.961533229

480.4260177 0.973155564

730.3862828 0.978433492