|
From: Lutz M. <ma...@be...> - 2007-03-18 01:10:51
|
Dear Andrey, I believe the features you are proposing might already be available in gnuplot, albeit with a less concise syntax. On Saturday 17 March 2007 11:40, Andrey V. Komolkin wrote: > First. In the "plot" command I propose to allow to setup range of 'x' > (independent) variable to each of functions/files. For instance: > > set xrange [0:10] > plot sin(x), cos(x) range [1:9], 'file.dat' range [1:9] with lines This can be done using set xrange [0:10] plot sin(x), (x >= 1 && x <= 9 ? cos(x) : 1/0), 'file.dat' using 1:($1 >= 1 && $1 <= 9 ? $2 : 1/0) with lines (This assumes that file.dat contains rows of (x,y) pairs. If instead it contains rows of single numbers, replace $1 by $0 and $2 by $1). > Imagine, the data we like to approximate have two parts: > > f1(x)=a*x+b > fit [0:5] f1(x) 'file.dat' via a,b > f2(x)=c*x+d > fit [6:10] f2(x) 'file.dat' via c,d > set xr [0:10] > plot 'file.dat' w p, [0:5] f1(x), [6:10] f2(x) Try plot 'file.dat' w p, (x >= 0 && x <= 5 ? f1(x) : 1/0), (x >= 6 && x <= 10 ? f2(x) : 1/0) > Second. Let me propose "dashed" ranges: [0:10,20:30]. This feature may > be useful for approximation of experimental data. > t(x)=a*x+b > fit [*:-5,5:*] t(x) 'file.dat' via a,b > set xr [-10:10] > plot t(x) range [-10:-5,5:10], 'file.dat' with points t(x)=a*x+b fit t(x) 'file.dat' using 1:($1 < -5 || $1 > 5 ? $2 : 1/0) via a,b set xr [-10:10] plot (x < -5 || x > 5 ? t(x) : 1/0), 'file.dat' with points You can find the details in "help using" and "help ternary". Hope this helps, Lutz |