SHA256
1
0
forked from pool/gnuplot
gnuplot/gnuplot-4.6.0-demo.diff

179 lines
5.4 KiB
Diff
Raw Normal View History

diff -ur ../gnuplot-5.0.0.orig/demo/fit.dem ./demo/fit.dem
--- ../gnuplot-5.0.0.orig/demo/fit.dem 2014-09-21 06:54:31.000000000 +0200
+++ ./demo/fit.dem 2015-01-21 20:35:15.303678726 +0100
@@ -10,6 +10,7 @@
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
@@ -29,6 +30,7 @@
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)
@@ -167,7 +169,7 @@
fit f(x,y) 'soundvel.dat' using 1:-2:2 via 'sound.par'
#create soundfit.par, reading from sound.par and updating values
-update 'sound.par' 'soundfit.par'
+update 'sound.par' "`mktemp /tmp/soundfit.par.XXXXXX`"
set title 'pseudo-3d multi-branch fit to velocity data'
plot 'soundvel.dat', vlong(x), vtrans(x)
print ''
@@ -323,6 +325,7 @@
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"
@@ -428,6 +431,7 @@
print ''
pause -1 "Done with fitting demo (-> return)"
reset
+set fit logfile logfile
set encoding myencoding
# release datablock
undefine $PearsonYork
diff -ur ../gnuplot-5.0.0.orig/demo/poldat.dem ./demo/poldat.dem
--- ../gnuplot-5.0.0.orig/demo/poldat.dem 2014-07-23 18:56:13.000000000 +0200
+++ ./demo/poldat.dem 2015-01-21 20:27:11.764634013 +0100
@@ -11,7 +11,7 @@
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]
diff -ur ../gnuplot-5.0.0.orig/demo/simple.dem ./demo/simple.dem
--- ../gnuplot-5.0.0.orig/demo/simple.dem 2012-11-19 18:35:09.000000000 +0100
+++ ./demo/simple.dem 2015-01-21 20:38:52.998698856 +0100
@@ -8,14 +8,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"
diff -ur ../gnuplot-5.0.0.orig/demo/stringvar.dem ./demo/stringvar.dem
--- ../gnuplot-5.0.0.orig/demo/stringvar.dem 2014-09-09 05:35:33.000000000 +0200
+++ ./demo/stringvar.dem 2015-01-21 20:27:11.765634013 +0100
@@ -1,7 +1,8 @@
#
# Miscellaneous neat things you can do using the string variables code
#
-set print "stringvar.tmp"
+stringvar="`mktemp /tmp/stringvar.XXXXXX`"
+set print stringvar
print ""
print "Exercise substring handling"
print ""
@@ -27,7 +28,7 @@
unset print
-set label 1 system("cat stringvar.tmp") at graph 0.1, graph 0.9
+set label 1 system(sprintf("cat %s", stringvar)) at graph 0.1, graph 0.9
unset xtics
unset ytics
set yrange [0:1]
@@ -36,7 +37,7 @@
pause -1 "Hit return to continue"
-set print "stringvar.tmp"
+set print stringvar
print "Exercise string handling functions"
print ""
print "foo = ",foo
@@ -65,7 +66,7 @@
print ""
unset print
-set label 1 system("cat stringvar.tmp") at graph 0.1, graph 0.9
+set label 1 system(sprintf("cat %s", stringvar)) at graph 0.1, graph 0.9
unset xtics
unset ytics
set yrange [0:1]
diff -ur ../gnuplot-5.0.0.orig/src/show.c ./src/show.c
--- ../gnuplot-5.0.0.orig/src/show.c 2014-11-22 05:10:50.000000000 +0100
+++ ./src/show.c 2015-01-21 20:27:11.767634013 +0100
@@ -1038,6 +1038,15 @@
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")) {
diff -ur ../gnuplot-5.0.0.orig/src/variable.c ./src/variable.c
--- ../gnuplot-5.0.0.orig/src/variable.c 2013-07-03 00:19:09.000000000 +0200
+++ ./src/variable.c 2015-01-21 20:27:11.767634013 +0100
@@ -37,7 +37,10 @@
/* The Death of Global Variables - part one. */
#include <string.h>
-
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
#include "variable.h"
#include "alloc.h"
@@ -98,6 +101,17 @@
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);
@@ -106,6 +120,10 @@
/* 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;