forked from pool/gnuplot
134 lines
3.6 KiB
Diff
134 lines
3.6 KiB
Diff
---
|
|
demo/fit.dem | 4 ++++
|
|
demo/poldat.dem | 2 +-
|
|
demo/simple.dem | 3 +--
|
|
src/loadpath.c | 21 +++++++++++++++++++++
|
|
src/show.c | 9 +++++++++
|
|
5 files changed, 36 insertions(+), 3 deletions(-)
|
|
|
|
--- demo/fit.dem
|
|
+++ demo/fit.dem 2020-07-17 07:25:00.022670914 +0000
|
|
@@ -6,6 +6,7 @@ set dummy x, y
|
|
|
|
print "Some examples how data fitting using nonlinear least squares fit can be done."
|
|
print ''
|
|
+logfile = "`mktemp /tmp/fit.log.XXXXXX`"
|
|
|
|
print "We fit a straight line to the data -- only as a demo without physical meaning."
|
|
l(x) = y0 + m*x
|
|
@@ -25,6 +26,7 @@ set title 'data set and initial paramete
|
|
plot 'lcdemo.dat', l(x)
|
|
pause -1 "Now start fitting... (-> return)"
|
|
|
|
+set fit logfile logfile
|
|
fit l(x) 'lcdemo.dat' via y0, m
|
|
set title 'unweighted fit'
|
|
plot 'lcdemo.dat', l(x)
|
|
@@ -320,6 +322,7 @@ print ' "fit3.dat" u 1:2:3:4 via a0,
|
|
pause -1 "Press enter to proceed with the next example."
|
|
|
|
reset
|
|
+set fit logfile logfile
|
|
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"
|
|
@@ -425,6 +428,7 @@ print "to time."
|
|
print ''
|
|
pause -1 "Done with fitting demo (-> return)"
|
|
reset
|
|
+set fit logfile logfile
|
|
set encoding myencoding
|
|
# release datablock
|
|
undefine $PearsonYork
|
|
--- demo/poldat.dem
|
|
+++ demo/poldat.dem 2020-07-17 07:25:00.022670914 +0000
|
|
@@ -7,7 +7,7 @@ unset grid
|
|
unset polar
|
|
set title "Primitive Smith Chart"
|
|
unset key
|
|
-set xlabel "Impedance or Admittance Coordinates"
|
|
+set xlabel "Impedance or Admittance Coordinates" offset 12,-1
|
|
set para
|
|
set rrange [-0 : 10]
|
|
set trange [-pi : pi]
|
|
--- demo/simple.dem
|
|
+++ demo/simple.dem 2020-07-17 07:25:00.022670914 +0000
|
|
@@ -5,14 +5,13 @@
|
|
#
|
|
set title "Simple Plots" font ",20"
|
|
set key left box
|
|
-set samples 50
|
|
+set samples 400
|
|
set style data points
|
|
|
|
plot [-10:10] sin(x),atan(x),cos(atan(x))
|
|
pause -1 "Hit return to continue"
|
|
|
|
set key right nobox
|
|
-set samples 100
|
|
plot [-pi/2:pi] cos(x),-(sin(x) > sin(x+1) ? sin(x) : sin(x+1))
|
|
pause -1 "Hit return to continue"
|
|
|
|
--- src/loadpath.c
|
|
+++ src/loadpath.c 2024-01-08 09:15:14.362384507 +0000
|
|
@@ -31,6 +31,10 @@
|
|
]*/
|
|
|
|
#include <string.h>
|
|
+#include <stdio.h>
|
|
+#include <sys/types.h>
|
|
+#include <sys/stat.h>
|
|
+#include <unistd.h>
|
|
|
|
#include "loadpath.h"
|
|
#include "alloc.h"
|
|
@@ -72,6 +76,18 @@ init_loadpath()
|
|
if (!loadpath)
|
|
{
|
|
char *envlib = getenv("GNUPLOT_LIB");
|
|
+#ifdef GNUPLOT_LIB_DEFAULT
|
|
+ char *defenvlib = (char*)0;
|
|
+ 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;
|
|
+ }
|
|
+#endif /* GNUPLOT_LIB_DEFAULT */
|
|
+
|
|
if (envlib) {
|
|
int len = strlen(envlib);
|
|
loadpath = gp_strdup(envlib);
|
|
@@ -81,6 +97,11 @@ init_loadpath()
|
|
PATHSEP_TO_NUL(loadpath);
|
|
}
|
|
/* else: NULL = empty */
|
|
+#ifdef GNUPLOT_LIB_DEFAULT
|
|
+ if (defenvlib)
|
|
+ free(defenvlib);
|
|
+#endif /* GNUPLOT_LIB_DEFAULT */
|
|
+
|
|
}
|
|
/* point to env portion of loadpath */
|
|
envptr = loadpath;
|
|
--- src/show.c
|
|
+++ src/show.c 2020-07-17 07:25:00.022670914 +0000
|
|
@@ -1140,6 +1140,15 @@ show_version(FILE *fp)
|
|
p /* type "help seeking-assistance" */
|
|
);
|
|
|
|
+#ifdef GNUPLOT_LIB_DEFAULT
|
|
+ {
|
|
+ struct stat st;
|
|
+ if ((stat(GNUPLOT_LIB_DEFAULT, &st) == 0) && S_ISDIR(st.st_mode)) {
|
|
+ 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);
|
|
+ }
|
|
+ }
|
|
+#endif
|
|
|
|
/* show version long */
|
|
if (almost_equals(c_token, "l$ong")) {
|