2016-12-15 14:11:36 +01:00
|
|
|
---
|
2017-09-29 09:57:40 +02:00
|
|
|
demo/fit.dem | 4 ++++
|
|
|
|
demo/poldat.dem | 2 +-
|
|
|
|
demo/simple.dem | 3 +--
|
|
|
|
src/show.c | 9 +++++++++
|
|
|
|
src/variable.c | 20 +++++++++++++++++++-
|
|
|
|
5 files changed, 34 insertions(+), 4 deletions(-)
|
2016-12-15 14:11:36 +01:00
|
|
|
|
|
|
|
--- demo/fit.dem
|
2018-05-07 09:16:41 +02:00
|
|
|
+++ demo/fit.dem 2018-05-07 07:11:51.433579608 +0000
|
2016-12-15 14:11:36 +01:00
|
|
|
@@ -10,6 +10,7 @@ set dummy x, y
|
2010-04-07 21:19:15 +02:00
|
|
|
|
2015-01-23 15:40:26 +01:00
|
|
|
print "Some examples how data fitting using nonlinear least squares fit can be done."
|
|
|
|
print ''
|
2010-04-07 21:19:15 +02:00
|
|
|
+logfile = "`mktemp /tmp/fit.log.XXXXXX`"
|
2007-09-06 22:19:11 +02:00
|
|
|
|
2015-01-23 15:40:26 +01:00
|
|
|
print "We fit a straight line to the data -- only as a demo without physical meaning."
|
|
|
|
l(x) = y0 + m*x
|
2016-12-15 14:11:36 +01:00
|
|
|
@@ -29,6 +30,7 @@ set title 'data set and initial paramete
|
2015-01-23 15:40:26 +01:00
|
|
|
plot 'lcdemo.dat', l(x)
|
|
|
|
pause -1 "Now start fitting... (-> return)"
|
|
|
|
|
2010-04-07 21:19:15 +02:00
|
|
|
+set fit logfile logfile
|
2015-01-23 15:40:26 +01:00
|
|
|
fit l(x) 'lcdemo.dat' via y0, m
|
|
|
|
set title 'unweighted fit'
|
|
|
|
plot 'lcdemo.dat', l(x)
|
2017-09-29 09:57:40 +02:00
|
|
|
@@ -324,6 +326,7 @@ print ' "fit3.dat" u 1:2:3:4 via a0,
|
2015-01-23 15:40:26 +01:00
|
|
|
pause -1 "Press enter to proceed with the next example."
|
2010-04-07 21:19:15 +02:00
|
|
|
|
|
|
|
reset
|
|
|
|
+set fit logfile logfile
|
2015-01-23 15:40:26 +01:00
|
|
|
print "\n"
|
|
|
|
print "The fit command can handle errors in the independent variable, too."
|
|
|
|
print "The problem shown here is Pearson's data with York's weights.\n"
|
2017-09-29 09:57:40 +02:00
|
|
|
@@ -429,6 +432,7 @@ print "to time."
|
2015-01-23 15:40:26 +01:00
|
|
|
print ''
|
2010-04-07 21:19:15 +02:00
|
|
|
pause -1 "Done with fitting demo (-> return)"
|
|
|
|
reset
|
|
|
|
+set fit logfile logfile
|
2015-01-23 15:40:26 +01:00
|
|
|
set encoding myencoding
|
|
|
|
# release datablock
|
|
|
|
undefine $PearsonYork
|
2016-12-15 14:11:36 +01:00
|
|
|
--- demo/poldat.dem
|
2018-05-07 09:16:41 +02:00
|
|
|
+++ demo/poldat.dem 2018-05-07 07:11:51.433579608 +0000
|
2016-12-15 14:11:36 +01:00
|
|
|
@@ -11,7 +11,7 @@ unset grid
|
2009-06-15 16:35:00 +02:00
|
|
|
unset polar
|
|
|
|
set title "Primitive Smith Chart"
|
2007-09-06 22:19:11 +02:00
|
|
|
unset key
|
2009-06-15 16:35:00 +02:00
|
|
|
-set xlabel "Impedance or Admittance Coordinates"
|
2010-04-07 21:19:15 +02:00
|
|
|
+set xlabel "Impedance or Admittance Coordinates" offset 12,-1
|
2009-06-15 16:35:00 +02:00
|
|
|
set para
|
|
|
|
set rrange [-0 : 10]
|
|
|
|
set trange [-pi : pi]
|
2016-12-15 14:11:36 +01:00
|
|
|
--- demo/simple.dem
|
2018-05-07 09:16:41 +02:00
|
|
|
+++ demo/simple.dem 2018-05-07 07:11:51.433579608 +0000
|
2015-01-23 15:40:26 +01:00
|
|
|
@@ -8,14 +8,13 @@
|
2010-04-07 21:19:15 +02:00
|
|
|
#
|
2015-01-23 15:40:26 +01:00
|
|
|
set title "Simple Plots" font ",20"
|
2010-04-07 21:19:15 +02:00
|
|
|
set key left box
|
|
|
|
-set samples 50
|
|
|
|
+set samples 400
|
2015-01-23 15:40:26 +01:00
|
|
|
set style data points
|
|
|
|
|
2010-04-07 21:19:15 +02:00
|
|
|
plot [-10:10] sin(x),atan(x),cos(atan(x))
|
|
|
|
pause -1 "Hit return to continue"
|
2007-09-06 22:19:11 +02:00
|
|
|
|
2010-04-07 21:19:15 +02:00
|
|
|
set key right nobox
|
|
|
|
-set samples 100
|
|
|
|
plot [-pi/2:pi] cos(x),-(sin(x) > sin(x+1) ? sin(x) : sin(x+1))
|
2007-09-06 22:19:11 +02:00
|
|
|
pause -1 "Hit return to continue"
|
|
|
|
|
2016-12-15 14:11:36 +01:00
|
|
|
--- src/show.c
|
2018-05-07 09:16:41 +02:00
|
|
|
+++ src/show.c 2018-05-07 07:11:51.437579533 +0000
|
|
|
|
@@ -1082,6 +1082,15 @@ show_version(FILE *fp)
|
2012-04-02 16:02:56 +02:00
|
|
|
p /* type "help seeking-assistance" */
|
2010-05-12 18:26:55 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
+#ifdef GNUPLOT_LIB_DEFAULT
|
|
|
|
+ {
|
|
|
|
+ struct stat st;
|
|
|
|
+ if ((stat(GNUPLOT_LIB_DEFAULT, &st) == 0) && S_ISDIR(st.st_mode)) {
|
2010-09-14 17:16:45 +02:00
|
|
|
+ fprintf(fp, "%s\n%s\tType `load \"all.dem\"` to display a large number of examples.", p, p);
|
|
|
|
+ fprintf(fp, "\n%s\tThey are located at %s/*\n%s\n", p, GNUPLOT_LIB_DEFAULT, p);
|
2010-05-12 18:26:55 +02:00
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
/* show version long */
|
|
|
|
if (almost_equals(c_token, "l$ong")) {
|
2016-12-15 14:11:36 +01:00
|
|
|
--- src/variable.c
|
2018-05-07 09:16:41 +02:00
|
|
|
+++ src/variable.c 2018-05-07 07:11:51.437579533 +0000
|
2016-12-15 14:11:36 +01:00
|
|
|
@@ -37,7 +37,10 @@ static char *RCSid() { return RCSid("$Id
|
2010-04-07 21:19:15 +02:00
|
|
|
/* The Death of Global Variables - part one. */
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
-
|
|
|
|
+#include <stdio.h>
|
2010-05-12 18:26:55 +02:00
|
|
|
+#include <sys/types.h>
|
|
|
|
+#include <sys/stat.h>
|
|
|
|
+#include <unistd.h>
|
2010-04-07 21:19:15 +02:00
|
|
|
#include "variable.h"
|
|
|
|
|
|
|
|
#include "alloc.h"
|
2016-12-15 14:11:36 +01:00
|
|
|
@@ -98,6 +101,17 @@ loadpath_handler(int action, char *path)
|
2009-06-15 16:35:00 +02:00
|
|
|
if (!loadpath)
|
|
|
|
{
|
|
|
|
char *envlib = getenv("GNUPLOT_LIB");
|
|
|
|
+#ifdef GNUPLOT_LIB_DEFAULT
|
|
|
|
+ char *defenvlib = (char*)0;
|
2010-05-12 18:26:55 +02:00
|
|
|
+ struct stat st;
|
|
|
|
+ if ((stat(GNUPLOT_LIB_DEFAULT, &st) == 0) && S_ISDIR(st.st_mode)) {
|
|
|
|
+ if (envlib) {
|
|
|
|
+ if (asprintf(&defenvlib, "%s:%s", envlib, GNUPLOT_LIB_DEFAULT) > 0)
|
|
|
|
+ envlib = defenvlib;
|
|
|
|
+ } else
|
|
|
|
+ envlib = GNUPLOT_LIB_DEFAULT;
|
|
|
|
+ }
|
2009-06-15 16:35:00 +02:00
|
|
|
+#endif /* GNUPLOT_LIB_DEFAULT */
|
|
|
|
if (envlib) {
|
|
|
|
int len = strlen(envlib);
|
|
|
|
loadpath = gp_strdup(envlib);
|
2016-12-15 14:11:36 +01:00
|
|
|
@@ -106,6 +120,10 @@ loadpath_handler(int action, char *path)
|
2009-06-15 16:35:00 +02:00
|
|
|
/* convert all PATHSEPs to \0 */
|
|
|
|
PATHSEP_TO_NUL(loadpath);
|
|
|
|
} /* else: NULL = empty */
|
|
|
|
+#ifdef GNUPLOT_LIB_DEFAULT
|
|
|
|
+ if (defenvlib)
|
|
|
|
+ free(defenvlib);
|
|
|
|
+#endif /* GNUPLOT_LIB_DEFAULT */
|
|
|
|
} /* else: already initialised; int_warn (?) */
|
|
|
|
/* point to env portion of loadpath */
|
|
|
|
envptr = loadpath;
|