home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume24 / gnuplot3 / part10 < prev    next >
Text File  |  1991-10-27  |  50KB  |  1,526 lines

  1. Newsgroups: comp.sources.misc
  2. From: gershon%gr@cs.utah.edu (Elber Gershon)
  3. Subject:  v24i032:  gnuplot3 - interactive function plotting utility, Part10/26
  4. Message-ID: <1991Oct28.002111.12035@sparky.imd.sterling.com>
  5. X-Md4-Signature: d552b94adbfaec352034e3662dbd63ca
  6. Date: Mon, 28 Oct 1991 00:21:11 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: gershon%gr@cs.utah.edu (Elber Gershon)
  10. Posting-number: Volume 24, Issue 32
  11. Archive-name: gnuplot3/part10
  12. Environment: UNIX, MS-DOS, VMS
  13. Supersedes: gnuplot2: Volume 11, Issue 65-79
  14.  
  15. #!/bin/sh
  16. # this is Part.10 (part 10 of a multipart archive)
  17. # do not concatenate these parts, unpack them in order with /bin/sh
  18. # file gnuplot/docs/gnuplot.doc continued
  19. #
  20. if test ! -r _shar_seq_.tmp; then
  21.     echo 'Please unpack part 1 first!'
  22.     exit 1
  23. fi
  24. (read Scheck
  25.  if test "$Scheck" != 10; then
  26.     echo Please unpack part "$Scheck" next!
  27.     exit 1
  28.  else
  29.     exit 0
  30.  fi
  31. ) < _shar_seq_.tmp || exit 1
  32. if test ! -f _shar_wnt_.tmp; then
  33.     echo 'x - still skipping gnuplot/docs/gnuplot.doc'
  34. else
  35. echo 'x - continuing file gnuplot/docs/gnuplot.doc'
  36. sed 's/^X//' << 'SHAR_EOF' >> 'gnuplot/docs/gnuplot.doc' &&
  37. ?nozeroaxis
  38. X `set zeroaxis` draws the x-axis and y-axis. By default, this option is
  39. X on.  `set nozeroaxis` causes GNUPLOT to omit the axes, and is
  40. X equivalent to `set noxzeroaxis; set noyzeroaxis.`
  41. X Syntax:
  42. X         set zeroaxis
  43. X         set nozeroaxis
  44. X         show zeroaxis
  45. X See `set xzeroaxis` and `set yzeroaxis`.
  46. 3 zlabel
  47. ?set zlabel
  48. ?show zlabel
  49. ?zlabel
  50. X The `set zlabel` command sets the z-axis label that is centered along
  51. X the z axis. Using the optional x,y screen offsets, the label can be
  52. X placed anywhere on the plot. `set zlabel` with no parameters clears
  53. X the label.
  54. X Syntax: 
  55. X          set zlabel {"<label>"} {<xoff>}{,<yoff>}
  56. X          show zlabel
  57. X Specifying constants <xoff> or <yoff> as optional offsets for the
  58. X label will move the label <xoff> or <yoff> character screen
  59. X coordinates. For example,
  60. X          set zlabel ,1
  61. X will change only the y offset of the zlabel, moving the label roughly
  62. X one character height up.
  63. X The zlabel will be drawn whenever surfaces or contours are plotted,
  64. X in the space above the grid level.
  65. X (The LaTeX, EEPIC, and Imagen drivers allow \\ in a string to specify
  66. X a newline.)
  67. 3 zrange
  68. ?set zrange
  69. ?show zrange
  70. ?zrange
  71. X The `set zrange` command sets the vertical range that will be
  72. X displayed. This command turns z axis autoscaling off.  The zrange is
  73. X used only by `splot` and is ignored by `plot`.
  74. X This range may also be specified on the `splot` command line.
  75. X Syntax:
  76. X         set zrange [{<zmin> : <zmax>}]
  77. X where <zmin> and <zmax> terms are constants or expressions.
  78. X Both the <zmin> and <zmax> terms are optional. Anything omitted will
  79. X not be changed, so
  80. X         set zrange [2:]
  81. X changes zmin to 2 without affecting zmax.
  82. 3 ztics
  83. ?set ztics
  84. ?set noztics
  85. ?show ztics
  86. ?ztics
  87. ?noztics
  88. X The `set ztics` and `set noztics` commands are similar to the `set
  89. X xtics` and `set noxtics` commands. Please see `set xtics`.
  90. 2 shell
  91. ?shell
  92. X The `shell` command spawns an interactive shell. To return to
  93. X GNUPLOT, type `logout` if using VMS, `exit` or the END-OF-FILE
  94. X character if using Unix, `endcli` if using AmigaDOS, or `exit` if
  95. X using MS-DOS.
  96. X A single shell command may be spawned by preceding it with the !
  97. X character ($ if using VMS) at the beginning of a command line.
  98. X Control will return immediately to GNUPLOT after this command is
  99. X executed. For example, in VMS, AmigaDOS, or MS-DOS,
  100. X      ! dir
  101. X prints a directory listing and then returns to GNUPLOT.
  102. 2 splot
  103. X Three-dimensional surface and contour plotting is available in
  104. X GNUPLOT with the `splot` command. See the `plot` command for features
  105. X common to the `plot` command.
  106. X See also `set contour`, `set cntrparam`, and `set surface`.
  107. 2 start-up
  108. ?startup
  109. ?start
  110. ?.gnuplot
  111. X When GNUPLOT is run, it looks for an initialization file to load.
  112. X This file is called `.gnuplot` on Unix and AmigaDOS systems, and
  113. X `GNUPLOT.INI` on other systems. If this file is not found in the
  114. X current directory, the program will look for it in the home directory
  115. X (under AmigaDOS and MS-DOS, the environment variable GNUPLOT should
  116. X contain the name of this directory).
  117. X If this file is found, GNUPLOT executes the commands in this file.
  118. X This is most useful for setting the terminal type and defining any
  119. X functions or variables that are used often.
  120. 2 substitution
  121. ?substitution
  122. X Command-line substitution is specified by a system command enclosed in
  123. X backquotes. This command is spawned and the output it produces
  124. X replaces the name of the command (and backquotes) on the command line.
  125. X Newlines in the output produced by the spawned command are replaced
  126. X with blanks.
  127. X Command-line substitution can be used anywhere on the GNUPLOT command
  128. X line.
  129. X Example:
  130. X This will run the program `leastsq` and replace `leastsq` (including
  131. X backquotes) on the command line with its output:
  132. X          f(x) = `leastsq`
  133. X or, in VMS
  134. X          f(x) = `run leastsq`
  135. 2 user-defined
  136. ?userdefined
  137. ?variables
  138. X New user-defined variables and functions of one or two variables may be 
  139. X declared and used anywhere.
  140. X User-defined function syntax:
  141. X         <function-name> ( <dummy-var1> {,<dummy-var2>} ) =  <expression>
  142. X where <expression> is defined in terms of <dummy-var1> and <dummy-var2>.
  143. X
  144. X User-defined variable syntax:
  145. X         <variable-name> = <constant-expression>
  146. X Examples:
  147. X         w = 2
  148. X         q = floor(tan(pi/2 - 0.1))
  149. X         f(x) = sin(w*x)
  150. X         sinc(x) = sin(pi*x)/(pi*x)
  151. X         delta(t) = (t == 0)
  152. X         ramp(t) = (t > 0) ? t : 0
  153. X         min(a,b) = (a < b) ? a : b
  154. X         comb(n,k) = n!/(k!*(n-k)!)
  155. X Note that the variable `pi` is already defined.
  156. X See `show functions` and `show variables`.
  157. 2 bugs
  158. ?bugs
  159. X The atan() function does not work correctly for complex arguments.
  160. X The bessel functions do not work for complex arguments.
  161. X The gamma function does not work for complex arguments.
  162. X There is a bug in the stdio library for old Sun operating systems
  163. X (SunOS Sys4-3.2). The "%g" format for 'printf' sometimes incorrectly
  164. X prints numbers (e.g., 200000.0 as "2"). Thus, tic mark labels may be
  165. X incorrect on a Sun4 version of GNUPLOT. A work-around is to rescale
  166. X the data or use the `set format` command to change the tic mark format
  167. X to "%7.0f" or some other appropriate format. This appears to have been
  168. X fixed in SunOS 4.0.
  169. X Another bug: On a Sun3 under SunOS 4.0, and on Sun4's under Sys4-3.2
  170. X and SunOS 4.0, the 'sscanf' routine incorrectly parses "00 12" with
  171. X the format "%f %f" and reads 0 and 0 instead of 0 and 12. This
  172. X affects data input. If the data file contains x coordinates that are
  173. X zero but are specified like '00', '000', etc, then you will read the
  174. X wrong y values. Check any data files or upgrade the SunOS.
  175. X It appears to have been fixed in SunOS 4.1.1.
  176. X Microsoft C 5.1 has a nasty bug associated with the %g format for
  177. X printf. When any of the formats "%.2g", "%.1g", "%.0g", "%.g" are
  178. X used, printf will incorrectly print numbers in the range 1e-4 to 1e-1.
  179. X Numbers that should be printed in the %e format are incorrectly 
  180. X printed in the %f format, with the wrong number of zeros after the 
  181. X decimal point.
  182. X
  183. X To work around this problem, use the %e or %f formats explicitly.
  184. X GNUPLOT, when compiled with Microsoft C, did not work correctly on two
  185. X VGA displays that were tested. The CGA, EGA and VGA drivers should 
  186. X probably be rewritten to use the Microsoft C graphics library.
  187. X GNUPLOT compiled with Turbo C uses the Turbo C graphics drivers and 
  188. X does work correctly with VGA displays.
  189. X VAX/VMS 4.7 C compiler release 2.4 also has a poorly implemented %g 
  190. X format for printf. The numbers are printed numerically correct, but 
  191. X may not be in the requested format. The K&R second edition says that 
  192. X for the %g format, %e is used if the exponent is less than -4 or greater 
  193. X than or equal to the precision. The VAX uses %e format if the exponent 
  194. X is less than -1. The VAX appears to take no notice of the precision 
  195. X when deciding whether to use %e or %f for numbers less than 1.
  196. X To work around this problem, use the %e or %f formats explicitly.
  197. X From the VAX C 2.4 release notes:
  198. X e,E,f,F,g,G  Result will always contain a decimal  point.
  199. X For g and G, trailing zeros will not be removed from the result.
  200. X VAX/VMS 5.2 C compiler release 3.0 has a slightly better implemented
  201. X %g format than release 2.4, but not much. Trailing decimal points are 
  202. X now removed, but trailing zeros are still not removed from %g numbers 
  203. X in exponential format.
  204. X
  205. X ULTRIX X11R3 has a bug that causes the X11 driver to display "every
  206. X other" plot.  The bug seems to be fixed in DEC's release of X11R4 so
  207. X newer releases of ULTRIX don't seem to have the problem.  Solutions for 
  208. X older sites include upgrading the X11 libraries (from DEC or direct from 
  209. X MIT) or defining ULTRIX_KLUDGE when compiling the x11.trm file.  Note 
  210. X that the kludge is not an ideal fix, however.
  211. X
  212. X The constant HUGE was incorrectly defined in the NeXT OS 2.0 operating
  213. X system.  HUGE should be set to 1e38 in plot.h. This error has been
  214. X corrected in the 2.1 version of NeXT OS.
  215. X
  216. X Please report any bugs to pixar!bug-gnuplot@sun.com or
  217. X pixar!bug-gnuplot@ucbvax.berkeley.edu.
  218. SHAR_EOF
  219. echo 'File gnuplot/docs/gnuplot.doc is complete' &&
  220. chmod 0644 gnuplot/docs/gnuplot.doc ||
  221. echo 'restore of gnuplot/docs/gnuplot.doc failed'
  222. Wc_c="`wc -c < 'gnuplot/docs/gnuplot.doc'`"
  223. test 90586 -eq "$Wc_c" ||
  224.     echo 'gnuplot/docs/gnuplot.doc: original size 90586, current size' "$Wc_c"
  225. rm -f _shar_wnt_.tmp
  226. fi
  227. # ============= gnuplot/docs/lasergnu.1 ==============
  228. if test -f 'gnuplot/docs/lasergnu.1' -a X"$1" != X"-c"; then
  229.     echo 'x - skipping gnuplot/docs/lasergnu.1 (File already exists)'
  230.     rm -f _shar_wnt_.tmp
  231. else
  232. > _shar_wnt_.tmp
  233. echo 'x - extracting gnuplot/docs/lasergnu.1 (Text)'
  234. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/lasergnu.1' &&
  235. .TH LASERGNU l 
  236. .SH NAME
  237. lasergnu \- send gnuplot output to a printer
  238. .SH SYNOPSIS
  239. .B lasergnu
  240. [ flags ] plot-command...
  241. .SH DESCRIPTION
  242. .I lasergnu
  243. runs
  244. .IR gnuplot (1)
  245. in an environment to produce typeset output on an IMAGEN  or
  246. Postscript printer.
  247. .PP
  248. The 
  249. .B gnuplot
  250. commands
  251. .B plot-command
  252. are performed and the output sent to the printer. 
  253. If the 
  254. .B -f
  255. option specifies a file for input, the plot command is optional. 
  256. The command-line plot commands are executed prior to any in the
  257. file(s).
  258. .PP
  259. For example, to plot the function
  260. .I sin(x)
  261. from -1 to +1, and to use printer im1, use the command
  262. .br
  263. .nf
  264. X    lasergnu -Pim1 'plot [-1:1] sin(x) with lines'
  265. .fi
  266. To execute the gnuplot command file
  267. .I myplot,
  268. on the postscript printer lw0, use the command
  269. .br
  270. .nf
  271. X    lasergnu -Plw0 -p -f myplot
  272. .fi
  273. The following switches are recognized:
  274. .TP
  275. .BI \-p
  276. Use the postscript language to make the plot, instead of Impress.
  277. This is for use on Postscript printers only. This uses a double-size
  278. plot in landscape mode as the default.
  279. .TP
  280. .BI \-P\0 printer
  281. The output of this program is intended for 
  282. .I printer.
  283. \ If the file is being spooled, this determines the printer it is spooled
  284. to (default: $LASER).
  285. Be sure to use the -p flag if the printer is a postscript printer.
  286. .TP
  287. .BI \-f\0 file
  288. Take gnuplot commands from the named file.
  289. Multiple files  may be supplied with separate -f options.
  290. .TP
  291. .BI  \-t\0 title
  292. Specify the title of the plot.
  293. .TP
  294. .BI \-b
  295. Do not print a banner page.
  296. .TP
  297. .BI \-J
  298. Do not print a banner page.
  299. .TP
  300. .B \-help
  301. Prints a list of options.
  302. .SH SEE ALSO
  303. gnuplot(l), lpr(1)
  304. SHAR_EOF
  305. chmod 0644 gnuplot/docs/lasergnu.1 ||
  306. echo 'restore of gnuplot/docs/lasergnu.1 failed'
  307. Wc_c="`wc -c < 'gnuplot/docs/lasergnu.1'`"
  308. test 1594 -eq "$Wc_c" ||
  309.     echo 'gnuplot/docs/lasergnu.1: original size 1594, current size' "$Wc_c"
  310. rm -f _shar_wnt_.tmp
  311. fi
  312. # ============= gnuplot/docs/latextut/Makefile ==============
  313. if test ! -d 'gnuplot/docs/latextut'; then
  314.     echo 'x - creating directory gnuplot/docs/latextut'
  315.     mkdir 'gnuplot/docs/latextut'
  316. fi
  317. if test -f 'gnuplot/docs/latextut/Makefile' -a X"$1" != X"-c"; then
  318.     echo 'x - skipping gnuplot/docs/latextut/Makefile (File already exists)'
  319.     rm -f _shar_wnt_.tmp
  320. else
  321. > _shar_wnt_.tmp
  322. echo 'x - extracting gnuplot/docs/latextut/Makefile (Text)'
  323. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/latextut/Makefile' &&
  324. # Makefile for gnuplot LaTeX tutorial
  325. # To make the manual from scratch, we run latex two times
  326. all: tutorial.dvi done
  327. X
  328. done:
  329. X    latex tutorial
  330. X    echo > done
  331. X
  332. # To touch it up after changes:
  333. remake: tutorial.dvi
  334. X
  335. # Always runs latex, e.g., to get labels right
  336. force: 
  337. X    latex tutorial
  338. X
  339. tutorial.dvi: eg1.tex eg2.tex eg3.tex eg4.tex eg5.tex eg6.tex linepoint.tex \
  340. X    tutorial.tex header.tex
  341. X    latex tutorial
  342. X    rm -f done
  343. X
  344. .SUFFIXES: .tex .plt
  345. X
  346. .plt.tex:
  347. X    gnuplot $<
  348. X
  349. clean:
  350. X    rm -f *~ *.log eg?.tex linepoint.tex
  351. X
  352. spotless:
  353. X    rm -f *~ *.log *.aux *.dvi eg?.tex linepoint.tex done
  354. SHAR_EOF
  355. chmod 0644 gnuplot/docs/latextut/Makefile ||
  356. echo 'restore of gnuplot/docs/latextut/Makefile failed'
  357. Wc_c="`wc -c < 'gnuplot/docs/latextut/Makefile'`"
  358. test 570 -eq "$Wc_c" ||
  359.     echo 'gnuplot/docs/latextut/Makefile: original size 570, current size' "$Wc_c"
  360. rm -f _shar_wnt_.tmp
  361. fi
  362. # ============= gnuplot/docs/latextut/eg1.plt ==============
  363. if test -f 'gnuplot/docs/latextut/eg1.plt' -a X"$1" != X"-c"; then
  364.     echo 'x - skipping gnuplot/docs/latextut/eg1.plt (File already exists)'
  365.     rm -f _shar_wnt_.tmp
  366. else
  367. > _shar_wnt_.tmp
  368. echo 'x - extracting gnuplot/docs/latextut/eg1.plt (Text)'
  369. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/latextut/eg1.plt' &&
  370. set terminal latex
  371. set output "eg1.tex"
  372. plot [-3.14:3.14] sin(x)
  373. SHAR_EOF
  374. chmod 0666 gnuplot/docs/latextut/eg1.plt ||
  375. echo 'restore of gnuplot/docs/latextut/eg1.plt failed'
  376. Wc_c="`wc -c < 'gnuplot/docs/latextut/eg1.plt'`"
  377. test 65 -eq "$Wc_c" ||
  378.     echo 'gnuplot/docs/latextut/eg1.plt: original size 65, current size' "$Wc_c"
  379. rm -f _shar_wnt_.tmp
  380. fi
  381. # ============= gnuplot/docs/latextut/eg2.plt ==============
  382. if test -f 'gnuplot/docs/latextut/eg2.plt' -a X"$1" != X"-c"; then
  383.     echo 'x - skipping gnuplot/docs/latextut/eg2.plt (File already exists)'
  384.     rm -f _shar_wnt_.tmp
  385. else
  386. > _shar_wnt_.tmp
  387. echo 'x - extracting gnuplot/docs/latextut/eg2.plt (Text)'
  388. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/latextut/eg2.plt' &&
  389. set terminal latex
  390. set output "eg2.tex"
  391. set size 5/5., 4/3.
  392. set format xy "$%g$"
  393. set title "This is a plot of $y=sin(x)$"
  394. set xlabel "This is the $x$ axis"
  395. set ylabel "This is\\the\\$y$ axis"
  396. plot [0:6.28] [0:1] sin(x)
  397. SHAR_EOF
  398. chmod 0666 gnuplot/docs/latextut/eg2.plt ||
  399. echo 'restore of gnuplot/docs/latextut/eg2.plt failed'
  400. Wc_c="`wc -c < 'gnuplot/docs/latextut/eg2.plt'`"
  401. test 219 -eq "$Wc_c" ||
  402.     echo 'gnuplot/docs/latextut/eg2.plt: original size 219, current size' "$Wc_c"
  403. rm -f _shar_wnt_.tmp
  404. fi
  405. # ============= gnuplot/docs/latextut/eg3.dat ==============
  406. if test -f 'gnuplot/docs/latextut/eg3.dat' -a X"$1" != X"-c"; then
  407.     echo 'x - skipping gnuplot/docs/latextut/eg3.dat (File already exists)'
  408.     rm -f _shar_wnt_.tmp
  409. else
  410. > _shar_wnt_.tmp
  411. echo 'x - extracting gnuplot/docs/latextut/eg3.dat (Text)'
  412. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/latextut/eg3.dat' &&
  413. -20.000000 -9.125028
  414. -19.000000 -9.109280
  415. -18.000000 -9.091787
  416. -17.000000 -9.072243
  417. -16.000000 -9.050265
  418. -15.000000 -9.025369
  419. -14.000000 -8.996933
  420. -13.000000 -8.964147
  421. -12.000000 -8.925931
  422. -11.000000 -8.880819
  423. -10.000000 -8.826766
  424. -9.000000 -8.760835
  425. -8.000000 -8.678648
  426. -7.000000 -8.573396
  427. -6.000000 -8.433886
  428. -5.000000 -8.240405
  429. -4.000000 -7.954906
  430. -3.000000 -7.494275
  431. -2.000000 -6.642892
  432. -1.000000 -4.712389
  433. 0.000000 0.000000
  434. 1.000000 4.712389
  435. 2.000000 6.642892
  436. 3.000000 7.494275
  437. 4.000000 7.954906
  438. 5.000000 8.240405
  439. 6.000000 8.433886
  440. 7.000000 8.573396
  441. 8.000000 8.678648
  442. 9.000000 8.760835
  443. 10.000000 8.826766
  444. 11.000000 8.880819
  445. 12.000000 8.925931
  446. 13.000000 8.964147
  447. 14.000000 8.996933
  448. 15.000000 9.025369
  449. 16.000000 9.050265
  450. 17.000000 9.072243
  451. 18.000000 9.091787
  452. 19.000000 9.109280
  453. SHAR_EOF
  454. chmod 0666 gnuplot/docs/latextut/eg3.dat ||
  455. echo 'restore of gnuplot/docs/latextut/eg3.dat failed'
  456. Wc_c="`wc -c < 'gnuplot/docs/latextut/eg3.dat'`"
  457. test 781 -eq "$Wc_c" ||
  458.     echo 'gnuplot/docs/latextut/eg3.dat: original size 781, current size' "$Wc_c"
  459. rm -f _shar_wnt_.tmp
  460. fi
  461. # ============= gnuplot/docs/latextut/eg3.plt ==============
  462. if test -f 'gnuplot/docs/latextut/eg3.plt' -a X"$1" != X"-c"; then
  463.     echo 'x - skipping gnuplot/docs/latextut/eg3.plt (File already exists)'
  464.     rm -f _shar_wnt_.tmp
  465. else
  466. > _shar_wnt_.tmp
  467. echo 'x - extracting gnuplot/docs/latextut/eg3.plt (Text)'
  468. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/latextut/eg3.plt' &&
  469. set terminal latex
  470. set output "eg3.tex"
  471. set format xy "$%g$"
  472. set title "This is another plot"
  473. set xlabel "$x$ axis"
  474. set ylabel "$y$ axis"
  475. set key 15,-10
  476. plot x with lines, "eg3.dat" with linespoints
  477. SHAR_EOF
  478. chmod 0666 gnuplot/docs/latextut/eg3.plt ||
  479. echo 'restore of gnuplot/docs/latextut/eg3.plt failed'
  480. Wc_c="`wc -c < 'gnuplot/docs/latextut/eg3.plt'`"
  481. test 199 -eq "$Wc_c" ||
  482.     echo 'gnuplot/docs/latextut/eg3.plt: original size 199, current size' "$Wc_c"
  483. rm -f _shar_wnt_.tmp
  484. fi
  485. # ============= gnuplot/docs/latextut/eg4.plt ==============
  486. if test -f 'gnuplot/docs/latextut/eg4.plt' -a X"$1" != X"-c"; then
  487.     echo 'x - skipping gnuplot/docs/latextut/eg4.plt (File already exists)'
  488.     rm -f _shar_wnt_.tmp
  489. else
  490. > _shar_wnt_.tmp
  491. echo 'x - extracting gnuplot/docs/latextut/eg4.plt (Text)'
  492. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/latextut/eg4.plt' &&
  493. set terminal latex
  494. set output "eg4.tex"
  495. set format y "$%g$"
  496. set format x "$%.2f$"
  497. set title "This is $\sin(x)$"
  498. set xlabel "This is the $x$ axis"
  499. set ylabel "$\sin(x)$"
  500. set nokey
  501. set xtics -pi, pi/4
  502. plot [-pi:pi] [-1:1] sin(x)
  503. SHAR_EOF
  504. chmod 0666 gnuplot/docs/latextut/eg4.plt ||
  505. echo 'restore of gnuplot/docs/latextut/eg4.plt failed'
  506. Wc_c="`wc -c < 'gnuplot/docs/latextut/eg4.plt'`"
  507. test 227 -eq "$Wc_c" ||
  508.     echo 'gnuplot/docs/latextut/eg4.plt: original size 227, current size' "$Wc_c"
  509. rm -f _shar_wnt_.tmp
  510. fi
  511. # ============= gnuplot/docs/latextut/eg5.plt ==============
  512. if test -f 'gnuplot/docs/latextut/eg5.plt' -a X"$1" != X"-c"; then
  513.     echo 'x - skipping gnuplot/docs/latextut/eg5.plt (File already exists)'
  514.     rm -f _shar_wnt_.tmp
  515. else
  516. > _shar_wnt_.tmp
  517. echo 'x - extracting gnuplot/docs/latextut/eg5.plt (Text)'
  518. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/latextut/eg5.plt' &&
  519. set terminal latex
  520. set output "eg5.tex"
  521. set format y "$%g$"
  522. set format x "$%4.1f\pi$"
  523. set noclip points
  524. set title "This is $\sin(x)$"
  525. set xlabel "This is the $x$ axis"
  526. set ylabel "$\sin(x)$"
  527. set nokey
  528. set xtics ("$-\pi$" -pi,\
  529. X "$-\frac{\pi}{2}$" -pi/2,\
  530. X "0" 0,\
  531. X "$\frac{\pi}{2}$" pi/2,\
  532. X "$\pi$" pi)
  533. plot [-pi:pi] [-1:1] sin(x)
  534. SHAR_EOF
  535. chmod 0666 gnuplot/docs/latextut/eg5.plt ||
  536. echo 'restore of gnuplot/docs/latextut/eg5.plt failed'
  537. Wc_c="`wc -c < 'gnuplot/docs/latextut/eg5.plt'`"
  538. test 331 -eq "$Wc_c" ||
  539.     echo 'gnuplot/docs/latextut/eg5.plt: original size 331, current size' "$Wc_c"
  540. rm -f _shar_wnt_.tmp
  541. fi
  542. # ============= gnuplot/docs/latextut/eg6.plt ==============
  543. if test -f 'gnuplot/docs/latextut/eg6.plt' -a X"$1" != X"-c"; then
  544.     echo 'x - skipping gnuplot/docs/latextut/eg6.plt (File already exists)'
  545.     rm -f _shar_wnt_.tmp
  546. else
  547. > _shar_wnt_.tmp
  548. echo 'x - extracting gnuplot/docs/latextut/eg6.plt (Text)'
  549. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/latextut/eg6.plt' &&
  550. set terminal latex
  551. set output "eg6.tex"
  552. set size 3.5/5, 3/3.
  553. set format y "$%g$"
  554. set format x "$%5.1f\mu$"
  555. set title "This is a title"
  556. set xlabel "This is the $x$ axis"
  557. set ylabel "This is\\a longer\\version\\ of\\the $y$\\ axis"
  558. set label "Data" at -5,-5 right
  559. set arrow from -5,-5 to -3.3,-6.7
  560. set key -4,8
  561. set xtic -10,5,10
  562. plot [-10:10] [-10:10] "eg3.dat" title "Data File"  with linespoints 1 7,\
  563. X   3*exp(-x*x)+1  title "$3e^{-x^{2}}+1$" with lines 4
  564. SHAR_EOF
  565. chmod 0666 gnuplot/docs/latextut/eg6.plt ||
  566. echo 'restore of gnuplot/docs/latextut/eg6.plt failed'
  567. Wc_c="`wc -c < 'gnuplot/docs/latextut/eg6.plt'`"
  568. test 457 -eq "$Wc_c" ||
  569.     echo 'gnuplot/docs/latextut/eg6.plt: original size 457, current size' "$Wc_c"
  570. rm -f _shar_wnt_.tmp
  571. fi
  572. # ============= gnuplot/docs/latextut/header.tex ==============
  573. if test -f 'gnuplot/docs/latextut/header.tex' -a X"$1" != X"-c"; then
  574.     echo 'x - skipping gnuplot/docs/latextut/header.tex (File already exists)'
  575.     rm -f _shar_wnt_.tmp
  576. else
  577. > _shar_wnt_.tmp
  578. echo 'x - extracting gnuplot/docs/latextut/header.tex (Text)'
  579. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/latextut/header.tex' &&
  580. % Header file for tutorial.tex
  581. %
  582. X
  583. % Spacing
  584. \newcommand{\singlespace}
  585. X  {\addtolength{\baselineskip}{-.333\baselineskip}}
  586. \newcommand{\doublespace}
  587. X  {\addtolength{\baselineskip}{.5\baselineskip}}
  588. X
  589. % Spacing for the whole document 
  590. \newcommand{\currentspace}{} % use this for single space
  591. % \newcommand{\currentspace}{\doubleespace} % use this for double space
  592. X
  593. % Common abbreviations
  594. % (Remember to put '\ ' after if an interword space is
  595. %  desired rather than end-of-sentence space. Same for '.etc)' ).
  596. \newcommand{\eg}{{\em e.g.}}        % e.g.
  597. \newcommand{\ie}{{\em i.e.}}        % i.e.
  598. \newcommand{\etc}{{\em etc.}}        % etc.
  599. \newcommand{\vs}{{\em vs.}}        % vs.
  600. \newcommand{\usec}{{$\mu$}sec}    % microseconds
  601. X
  602. % \boxfigure{pos}{wid}{text}:  A figure with a box around it
  603. %
  604. % pos    the usual figure placement arg: eg. htbp
  605. % wid    the width of the figure, in some units: eg. 5in
  606. % text    the contents of the figure, including picture/caption/label/etc
  607. %
  608. \newlength{\boxwidth}
  609. \newcommand{\boxfigure}[3]{
  610. X    \begin{figure}[#1]
  611. X        \setlength{\boxwidth}{#2}
  612. X        \addtolength{\boxwidth}{.1in}
  613. X
  614. X        \centering
  615. X        \framebox[\boxwidth]{
  616. X            \begin{minipage}{#2}
  617. X            #3
  618. X            \end{minipage}
  619. X        }
  620. X    \end{figure}  
  621. }
  622. X
  623. % use \fullboxwidth for arg 2 of boxfigure to get box of size \textwidth
  624. X
  625. % To show a syntax for a gnutex command
  626. \newenvironment{syntax}{\begin{quote}\tt}{\end{quote}}
  627. X
  628. \documentstyle[titlepage,11pt]{article}
  629. X
  630. % Margins
  631. \sloppy
  632. \setlength{\textwidth}{6.5in}
  633. \setlength{\textheight}{9in}
  634. \setlength{\topmargin}{-0.5in}
  635. \setlength{\oddsidemargin}{0pt}
  636. \setlength{\evensidemargin}{0pt}
  637. X
  638. % see above
  639. \newlength{\fullboxwidth}
  640. \setlength{\fullboxwidth}{\textwidth}
  641. \addtolength{\fullboxwidth}{-0.1in}
  642. X
  643. SHAR_EOF
  644. chmod 0644 gnuplot/docs/latextut/header.tex ||
  645. echo 'restore of gnuplot/docs/latextut/header.tex failed'
  646. Wc_c="`wc -c < 'gnuplot/docs/latextut/header.tex'`"
  647. test 1677 -eq "$Wc_c" ||
  648.     echo 'gnuplot/docs/latextut/header.tex: original size 1677, current size' "$Wc_c"
  649. rm -f _shar_wnt_.tmp
  650. fi
  651. # ============= gnuplot/docs/latextut/tutorial.tex ==============
  652. if test -f 'gnuplot/docs/latextut/tutorial.tex' -a X"$1" != X"-c"; then
  653.     echo 'x - skipping gnuplot/docs/latextut/tutorial.tex (File already exists)'
  654.     rm -f _shar_wnt_.tmp
  655. else
  656. > _shar_wnt_.tmp
  657. echo 'x - extracting gnuplot/docs/latextut/tutorial.tex (Text)'
  658. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/latextut/tutorial.tex' &&
  659. % Tutorial for GNUPLOT plotting program, for LaTeX users
  660. % David Kotz (David.Kotz@Dartmouth.edu)
  661. % Duke University Computer Science Department
  662. %
  663. % NOTE: If LaTeX runs out of memory processing plots,
  664. % add ``with lines 4'' to each curve in eg*.plt and rerun make.
  665. %
  666. X
  667. % some header info
  668. \input{header}
  669. X
  670. \begin{document}
  671. X
  672. \title{\LaTeX\ and the GNUPLOT Plotting 
  673. Program\thanks{This document describes GNUPLOT version 3.0. All plots
  674. in this document were made with that version of GNUPLOT.} }
  675. \author{David Kotz \\ \verb+David.Kotz@Dartmouth.edu+}
  676. \date{July 3, 1991}
  677. X
  678. \maketitle
  679. X
  680. \pagestyle{myheadings}
  681. \markright{GNUPLOT \LaTeX\ Tutorial Version 3.0}
  682. X
  683. \currentspace % defined in header.tex
  684. X
  685. \section{Introduction and History}
  686. X
  687. GNUPLOT was originally developed by Colin Kelley and Thomas Williams
  688. in 1986 to plot functions and data files on a variety of terminals.
  689. In 1988 and 1989 I created an alternate version, known as Gnu\TeX,
  690. that supported a new ``terminal type'' called {\tt latex}, so gnuplot
  691. would output \LaTeX\ code. The plot could then be included in a
  692. \LaTeX\ document. I added a number of embellishments, supported only
  693. by the {\tt latex} terminal, allowing the user to produce
  694. publication-quality plots.
  695. X
  696. In late 1989 and early 1990 Gnu\TeX\ and a number of other GNUPLOT
  697. variants were merged together into a new release of GNUPLOT, 2.0. This
  698. includes, among many other improvements, a \LaTeX\ driver derived from
  699. the one in Gnu\TeX. Former Gnu\TeX\ users are referred to
  700. Section~\ref{oldusers} for information about adapting to GNUPLOT.
  701. Anyone interested in using GNUPLOT with \LaTeX\ should read the next
  702. section, a tutorial, and the primary GNUPLOT manual.
  703. X
  704. The reader should note that the \LaTeX\ picture environments output by
  705. GNUPLOT can be quite large and complicated, and can easily exceed the
  706. memory capacity of \TeX. If an enlarged version of \TeX\ is available,
  707. it is wise to use it. Otherwise, keep your plots simple and add
  708. \verb+\clearpage+ to your document where necessary.
  709. X
  710. There is also a new EEPIC driver ({\tt eepic}), intended for use with
  711. the EEPIC macro package for \LaTeX. EEPIC allows for much more
  712. efficient line-drawing, runs through \LaTeX\ faster, and uses less
  713. memory.  See Section~\ref{s:eepic} for more information.
  714. X
  715. There is a small package of auxiliary files (makefiles and scripts)
  716. that I find useful for making \LaTeX\ plots with GNUPLOT. This is
  717. available for \verb+ftp+ as \verb+pub/gnuplot-latex.shar+ from
  718. \verb+cs.duke.edu+. I can mail copies (see the end of this paper for
  719. information).
  720. X
  721. \section{Using GNUPLOT for \LaTeX: a Tutorial}
  722. X
  723. GNUPLOT is by nature an interactive program. Users making plots for
  724. \LaTeX\ will generally not use GNUPLOT interactively.  Whenever hard
  725. copy is desired from GNUPLOT, the program need not be run on a
  726. graphics terminal. In this case the output is directed to a file or
  727. pipe, then sent to the appropriate output device. For example, output
  728. from the terminal type {\tt unixplot} may be sent to a program
  729. interpreting the Unix plotting standard. The terminal types {\tt
  730. imagen} and {\tt postscript} may be used for output to printers
  731. understanding those languages. (A shell script ({\tt lasergnu}) is
  732. supplied with the distribution that will accept a GNUPLOT command or
  733. input file and send the output to an Imagen or Postscript laser
  734. printer. This script may have been adapted to your site.) The terminal
  735. type {\tt fig} outputs FIG code that can be read by the Fig graphics
  736. program and translated into forms usable in both \TeX\ and
  737. \LaTeX\ documents.
  738. X
  739. We now ignore the interactive nature of GNUPLOT and provide the input
  740. to GNUPLOT from a file, \ie,
  741. \begin{verbatim}
  742. X      gnuplot gnu.input
  743. \end{verbatim}
  744. In this example, all of the commands to GNUPLOT are contained in the
  745. file {\tt gnu.input}. Multiple filenames may be supplied to GNUPLOT
  746. this way, read in the order they are given.  The output (one or more
  747. plots) may be piped to another program or redirected to a file.
  748. Usually, however, we direct the output explicitly with an instruction
  749. to GNUPLOT (the {\tt set output} command). GNUPLOT continues to print
  750. error messages to the terminal (stderr).
  751. X
  752. \paragraph{Example 1:} Here is a first example, producing a plot for
  753. this document. The GNUPLOT input file is given below, and the output
  754. appears as Figure~\ref{eg1}. The input file defines the output to be
  755. in \LaTeX, gives a file name for the output, and plots $y=sin(x)$ for
  756. $x$ on $[-\pi,\pi]$. To produce the figure, I simply
  757. \verb+\input{eg1}+ in a {\tt center} environment in a {\tt figure}
  758. environment. In following examples, I will enclose the figure in a box
  759. to make it look a little better.
  760. X
  761. \singlespace
  762. \begin{verbatim}
  763. X    set terminal latex
  764. X    set output "eg1.tex"
  765. X    plot [-3.14:3.14] sin(x)
  766. \end{verbatim}
  767. \currentspace
  768. X
  769. \begin{figure}[htbp]
  770. X  \begin{center}
  771. X    \input{eg1}
  772. X  \end{center}
  773. X  \caption{A first example: $y=sin(x)$} 
  774. X  \label{eg1}
  775. \end{figure}
  776. X
  777. Note that GNUPLOT has drawn in the axes, labeled the tic marks for us,
  778. scaled the $y$ axis automatically, and added a key in the
  779. upper-right-hand corner (this may be moved with the {\tt set key}
  780. command, and removed with {\tt set nokey}).
  781. X
  782. This is the default line style for the \LaTeX\ driver.  Because of the
  783. limited picture capabilities of \LaTeX, many dots are required to
  784. approximate drawing a solid line. This may overload the memory of many
  785. \TeX\ implementations. There are other line types available that draw
  786. dotted lines and use much less memory. The EEPIC driver draws solid
  787. lines with much less memory usage.
  788. X
  789. \paragraph{Example 2:} Now we will embellish the plot a little with
  790. some labels.  This input file produces Figure~\ref{eg2}.
  791. X
  792. \singlespace
  793. \begin{verbatim}
  794. X    set terminal latex
  795. X    set output "eg2.tex"
  796. X    set size 5/5., 4/3.
  797. X    set format xy "$%g$"
  798. X    set title "This is a plot of $y=sin(x)$"
  799. X    set xlabel "This is the $x$ axis"
  800. X    set ylabel "This is\\the\\$y$ axis"
  801. X    plot [0:6.28] [0:1] sin(x)
  802. \end{verbatim}
  803. \currentspace
  804. X
  805. \boxfigure{htbp}{\fullboxwidth}{
  806. X  \begin{center}
  807. X    \input{eg2}
  808. X  \end{center}
  809. X  \caption{A more fancy example.}
  810. X  \label{eg2}
  811. }
  812. X
  813. We have specified the plot to be 5 inches wide and 4 inches tall with
  814. the {\tt set size} command. This is the size of the area used by the
  815. plot, {\em including} space for the labels.  In the first example,
  816. this size was the default 5 inches by 3 inches. By specifying the
  817. scaling factors of 1 (or 5/5) and 1.3333 (or 4/3), we obtain the
  818. desired plot size. 
  819. X
  820. We have requested that the format used by the $x$- and $y$-axis tic
  821. mark labels be in \LaTeX\ math mode. This makes the labels look a
  822. little better. The default is \verb+set format xy "%g"+. The \verb+%g+
  823. represents the general-purpose floating point formatting specification
  824. for the {\tt printf} function in C. Any valid floating-point
  825. formatting specification, or \LaTeX\ command, is allowed in the
  826. format.
  827. X
  828. A title for the plot and labels for the axes were set up in the next
  829. three commands.  Note that they are processed by \LaTeX\ and so may
  830. have math mode and other symbols in them. The ylabel may have multiple
  831. lines, delineated with \verb+\\+.  The ylabel can be moved around with
  832. optional offset parameters (see {\tt set ylabel} in the GNUPLOT
  833. manual). Typically, the ylabel needs to be moved to the left to avoid
  834. interfering with the left-hand side of the plot.  Once these labels
  835. are set up, they will be used for all subsequent plot commands until
  836. they are changed. These labels are also supported by the other
  837. terminal types, but (of course) any \LaTeX\ code in the string will
  838. not be interpreted. We have also defined the range of both $x$ (now
  839. $[0,2\pi]$) and $y$ (here $[0,1]$).
  840. X
  841. So far we have plotted one curve, $y=\sin(x)$, on one plot. In
  842. GNUPLOT, each {\tt plot} command generates a new plot. If the output
  843. is to a screen, the screen is cleared. If to a printer, a new page is
  844. produced. In the {\tt latex} case, a new picture is started. It is not
  845. likely that \LaTeX\ users will want this to happen, so generally each
  846. plot has its own input file and is kept in a separate output ({\tt
  847. .tex}) file for inclusion at different places in the document.
  848. X
  849. \paragraph{Example 3:} To place more than one curve on a plot, use one
  850. {\tt plot} statement and separate the description of each curve by a
  851. comma. In our next example, we will plot both a function and a data
  852. file on the same plot. This plot is shown in Figure~\ref{eg3}.
  853. X
  854. \singlespace
  855. \begin{verbatim}
  856. X    set terminal latex
  857. X    set output "eg3.tex"
  858. X    set format xy "$%g$"
  859. X    set title "This is another plot"
  860. X    set xlabel "$x$ axis"
  861. X    set ylabel "$y$ axis"
  862. X    set key 15,-10
  863. X    plot x with lines, "eg3.dat" with linespoints
  864. \end{verbatim}
  865. \currentspace
  866. X
  867. \boxfigure{htbp}{\fullboxwidth}{
  868. X  \begin{center}
  869. X    \input{eg3}
  870. X  \end{center}
  871. X  \caption{An example with two curves on the same plot.}
  872. X  \label{eg3}
  873. }
  874. X
  875. Here you will see that the $x$ range was not specified. The $x$ range
  876. is determined automatically, unless specified by the user.  In
  877. this case, it is defined by the range of the data file
  878. \verb+"eg3.dat"+. The function is plotted over the same range. If no
  879. data files or $x$ range are supplied, the default range of $[-10:10]$
  880. is used. We have also moved the key to a different position.  The
  881. function $y=x$ is plotted ``with lines'', which is the default plot
  882. style for functions, and is shown here to illustrate the plot style
  883. option.  The data file {\tt eg3.dat} is plotted with style {\tt
  884. linespoints}, a style like {\tt lines} that also plots a symbol at
  885. each data point.
  886. X
  887. There is a style called {\tt points} that only plots the symbols at
  888. data points, and another called {\tt dots} that plots a tiny dot for
  889. each data point.  The {\tt points} and {\tt linespoints} styles
  890. produce a different point symbol for each curve on the plot (for up to
  891. twelve symbols, after which they are re-used; see
  892. Figure~\ref{linepoint} for a complete list). The {\tt lines} and {\tt
  893. linespoints} styles use a different line style for each curve on the
  894. plot (in this example the dots have different spacing). The
  895. style {\tt impulses} draws a perpendicular from each point to the
  896. $x$-axis. Finally, the {\tt errorbars} style can draw error bars at
  897. each data point (see the GNUPLOT manual). 
  898. X
  899. \paragraph{Example 4:} In the above plots of $\sin(x)$, it would make
  900. more sense to label the axis in units of $\pi$. The position and
  901. labels of the tic labels may be specified by the user, with the {\tt
  902. set xtics} and {\tt set ytics} commands. This is demonstrated by
  903. the following example, shown in Figure~\ref{eg4}.
  904. X
  905. \singlespace
  906. \begin{verbatim}
  907. X    set terminal latex
  908. X    set output "eg4.tex"
  909. X    set format y "$%g$"
  910. X    set format x "$%.2f$"
  911. X    set title "This is $\sin(x)$"
  912. X    set xlabel "This is the $x$ axis"
  913. X    set ylabel "$\sin(x)$"
  914. X    set nokey
  915. X    set xtics -pi, pi/4
  916. X    plot [-pi:pi] [-1:1] sin(x)
  917. \end{verbatim}
  918. \currentspace
  919. X
  920. \boxfigure{htbp}{\fullboxwidth}{
  921. X  \begin{center}
  922. X    \input{eg4}
  923. X  \end{center}
  924. X  \caption{An example of the {\tt set xtics} command.}
  925. X  \label{eg4}
  926. }
  927. X
  928. Since {\tt pi} is a predefined variable in GNUPLOT, we can use it
  929. anywhere we may use an expression. The {\tt set xtics} command here
  930. specifies that the tics on the $x$ axis start at $-\pi$ and increment
  931. by $\pi/4$. Since no end point is given, the tics continue to the
  932. right edge. We have also turned off the key, and changed the format to
  933. restrict the $x$-axis tic labels to 2 decimal places.
  934. X
  935. With a little more work, the plot can look even better.  Another form
  936. of this command allows us to specify the label and position of each
  937. tic individually.  Replacing the above {\tt set xtics} command with
  938. the following gives us Figure~\ref{eg5}. We also make use of the line
  939. continuation character, the backslash (\verb+\+), to spread out this
  940. command for readability.
  941. X
  942. \singlespace
  943. \begin{verbatim}
  944. X    set xtics ("$-\pi$" -pi,\
  945. X     "$-\frac{\pi}{2}$" -pi/2,\
  946. X     "0" 0,\
  947. X     "$\frac{\pi}{2}$" pi/2,\
  948. X     "$\pi$" pi)
  949. \end{verbatim}
  950. \currentspace
  951. X
  952. \boxfigure{htbp}{\fullboxwidth}{
  953. X  \begin{center}
  954. X    \input{eg5}
  955. X  \end{center}
  956. X  \caption{A fancy example of the {\tt set xtics} command.}
  957. X  \label{eg5}
  958. }
  959. X
  960. \paragraph{Going further:} You should now be able to make a variety of
  961. plots for your \LaTeX\ document. We will present a final example
  962. without explanation that showcases some of the capabilities of
  963. GNUPLOT. You may find documentation for the various commands in the
  964. GNUPLOT manual, though hopefully this example is somewhat
  965. self-explanatory. This is shown in Figure~\ref{eg6}.
  966. X
  967. \singlespace
  968. \begin{verbatim}
  969. X    set terminal latex
  970. X    set output "eg6.tex"
  971. X    set size 3.5/5, 3/3.
  972. X    set format y "$%g$"
  973. X    set format x "$%5.1f\mu$"
  974. X    set title "This is a title"
  975. X    set xlabel "This is the $x$ axis"
  976. X    set ylabel "This is\\a longer\\version\\ of\\the $y$\\ axis"
  977. X    set label "Data" at -5,-5 right
  978. X    set arrow from -5,-5 to -3.3,-6.7
  979. X    set key -4,8
  980. X    set xtic -10,5,10
  981. X    plot [-10:10] [-10:10] "eg3.dat" title "Data File"  with linespoints 1 7,\
  982. X       3*exp(-x*x)+1  title "$3e^{-x^{2}}+1$" with lines 4
  983. \end{verbatim}
  984. \currentspace
  985. X
  986. \boxfigure{htbp}{\fullboxwidth}{
  987. X  \begin{center}
  988. X    \input{eg6}
  989. X  \end{center}
  990. X  \caption{An example of many features.}
  991. X  \label{eg6}
  992. }
  993. X
  994. \paragraph{Line and point types:} For reference, we show all of the
  995. line and point types available in Figure~\ref{linepoint}.
  996. X
  997. \boxfigure{htbp}{\fullboxwidth}{
  998. X  \begin{center}
  999. X    \input{linepoint}
  1000. X  \end{center}
  1001. X  \caption{All of the line and point types in the \LaTeX\ driver.}
  1002. X  \label{linepoint}
  1003. }
  1004. X
  1005. \subsection{Summary --- Use with \LaTeX}
  1006. In summary, to use the \LaTeX\ facilities of GNUPLOT, the first
  1007. command to GNUPLOT should be
  1008. \begin{syntax}
  1009. X    set terminal latex
  1010. \end{syntax}
  1011. and the output of GNUPLOT should be directed to a file, for example,
  1012. \begin{verbatim}
  1013. X    set output "plot.tex"
  1014. \end{verbatim}
  1015. This may be anything you like but it should have a {\tt .tex} extension,
  1016. of course. Then the size of the plot should be given. For example, the
  1017. command 
  1018. \begin{verbatim}
  1019. X    set size 1,2
  1020. \end{verbatim}
  1021. tells GNUPLOT to use a 5 inch wide by 6 inch high box for the plot.
  1022. The numbers given are {\em scale factors}, not the actual size.  The
  1023. default is 5 inches by 3 inches.  This is the size of the complete
  1024. plot, including all labels.
  1025. X
  1026. When finished, the file will contain all of the plots you have
  1027. specified (you probably only want one plot per file). This file can
  1028. then be used in a \LaTeX\ document, \eg,
  1029. X
  1030. \singlespace
  1031. \begin{verbatim}
  1032. X    \begin {figure}
  1033. X      \begin{center}
  1034. X        \input{plot}
  1035. X      \end{center}
  1036. X    \end {figure}
  1037. \end{verbatim}
  1038. \currentspace
  1039. This puts the plot into a figure. 
  1040. X
  1041. You will also want to read about the following commands: {\tt set
  1042. title, set xlabel, set ylabel, set key, set label, set xtics, set
  1043. ytics}, and {\tt set clip}.  These are all described in the regular
  1044. GNUPLOT manual.
  1045. X
  1046. \section{Use with EEPIC}
  1047. \label{s:eepic}
  1048. EEPIC is a macro package extending the picture environment of \LaTeX.
  1049. If you have the EPIC or EEPIC macros, and your {\tt dvi} translator
  1050. supports the {\em tpic\/} \verb+\special+s, then you can save \LaTeX\
  1051. memory.  With EEPIC pictures, the {\tt plot.tex} file will be smaller,
  1052. \LaTeX\ will run much faster (and need much less memory), and the {\tt
  1053. dvi} file will be smaller. The quality of the output is about the
  1054. same. If you change the source, you can generate some more interesting
  1055. line styles.
  1056. X
  1057. To use EEPIC, set GNUPLOT's terminal type to {\tt eepic} instead of
  1058. {\tt latex}, and use GNUPLOT as before. The line styles will change.
  1059. Include the file {\tt plot.tex} in your document as before, along with
  1060. the document style options {\tt [epic,eepic]}.
  1061. X
  1062. \section{For Former Gnu\TeX\ Users}
  1063. \label{oldusers}
  1064. X
  1065. Former Gnu\TeX\ users may be pleased with many of the new features
  1066. (many inspired by your suggestions!), but will also find many changes.
  1067. GNUPLOT will {\em not\/} run all Gnu\TeX\ input files unchanged.
  1068. Several Gnu\TeX\ features were not included in GNUPLOT because they
  1069. were specific to the \LaTeX\ driver. I encourage you to use the newer
  1070. GNUPLOT.  A translator is available that attempts to translate your
  1071. old Gnu\TeX\ 1.6 input files into GNUPLOT 3.0 files. You can ftp it
  1072. from \verb+cs.duke.edu+ as \verb+dist/sources/gnuplot/gnut2p.tar.Z+.
  1073. This file also contains directions and a list of changes from Gnu\TeX\
  1074. to GNUPLOT.
  1075. X
  1076. \section{Contact}
  1077. Please contact me at \verb+David.Kotz@Dartmouth.edu+ with any comments you may
  1078. have on GNUPLOT's \LaTeX\ driver. For general GNUPLOT questions, send
  1079. mail to the GNUPLOT mailing list
  1080. (\verb+pixar!info-gnuplot@ucbvax.berkeley.edu+). 
  1081. X
  1082. X
  1083. \end{document}
  1084. SHAR_EOF
  1085. chmod 0644 gnuplot/docs/latextut/tutorial.tex ||
  1086. echo 'restore of gnuplot/docs/latextut/tutorial.tex failed'
  1087. Wc_c="`wc -c < 'gnuplot/docs/latextut/tutorial.tex'`"
  1088. test 16623 -eq "$Wc_c" ||
  1089.     echo 'gnuplot/docs/latextut/tutorial.tex: original size 16623, current size' "$Wc_c"
  1090. rm -f _shar_wnt_.tmp
  1091. fi
  1092. # ============= gnuplot/docs/latextut/linepoint.plt ==============
  1093. if test -f 'gnuplot/docs/latextut/linepoint.plt' -a X"$1" != X"-c"; then
  1094.     echo 'x - skipping gnuplot/docs/latextut/linepoint.plt (File already exists)'
  1095.     rm -f _shar_wnt_.tmp
  1096. else
  1097. > _shar_wnt_.tmp
  1098. echo 'x - extracting gnuplot/docs/latextut/linepoint.plt (Text)'
  1099. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/latextut/linepoint.plt' &&
  1100. # Plots all line types and point types
  1101. set term latex
  1102. set out "linepoint.tex"
  1103. set clip points
  1104. set dummy t,y
  1105. set nokey
  1106. set parametric
  1107. set samples 14     # for trange 0:13, we get 14 points: 0, 1, ..., 13
  1108. set function style lines
  1109. set xtics 1,1,12
  1110. set ytics 1,1,6
  1111. set title "Up to 6 line types and 12 point types"
  1112. set trange [0 : 13]
  1113. set xlabel "Points"
  1114. set xrange [0 : 13]
  1115. set ylabel "Lines"
  1116. set yrange [0 : 7]
  1117. plot t,1, t,2, t,3, t,4, t,5, t,6, 1,t w p, 2,t w p, 3,t w p, 4,t w p,5,t w p, 6,t w p, 7,t w p, 8,t w p, 9,t w p, 10,t w p, 11,t w p, 12,t w p
  1118. SHAR_EOF
  1119. chmod 0644 gnuplot/docs/latextut/linepoint.plt ||
  1120. echo 'restore of gnuplot/docs/latextut/linepoint.plt failed'
  1121. Wc_c="`wc -c < 'gnuplot/docs/latextut/linepoint.plt'`"
  1122. test 550 -eq "$Wc_c" ||
  1123.     echo 'gnuplot/docs/latextut/linepoint.plt: original size 550, current size' "$Wc_c"
  1124. rm -f _shar_wnt_.tmp
  1125. fi
  1126. # ============= gnuplot/docs/titlepage.ms ==============
  1127. if test -f 'gnuplot/docs/titlepage.ms' -a X"$1" != X"-c"; then
  1128.     echo 'x - skipping gnuplot/docs/titlepage.ms (File already exists)'
  1129.     rm -f _shar_wnt_.tmp
  1130. else
  1131. > _shar_wnt_.tmp
  1132. echo 'x - extracting gnuplot/docs/titlepage.ms (Text)'
  1133. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/titlepage.ms' &&
  1134. .nr HM 3.2i
  1135. .TL
  1136. GNUPLOT
  1137. .br
  1138. An Interactive Plotting Program
  1139. .sp
  1140. .AU
  1141. Thomas Williams & Colin Kelley
  1142. .br
  1143. X   Version 3.0 organized by: Gershon Elber
  1144. .br
  1145. X   Version 3.0 major contributors (alphabetic order):
  1146. .br
  1147. X  John Campbell
  1148. .br
  1149. X  Gershon Elber
  1150. .br
  1151. X  David Kotz
  1152. .br
  1153. X  Ed Kubaitis
  1154. .br
  1155. X  Russell Lang
  1156. .br
  1157. X  Tom Tkacik
  1158. .br
  1159. X  Alex Woo
  1160. X
  1161. .AI
  1162. X   Mailing list for comments: pixar!info-gnuplot@sun.com
  1163. .br
  1164. X   Mailing list for bug reports: pixar!bug-gnuplot@sun.com
  1165. \*(DY
  1166. .br
  1167. X
  1168. X
  1169. X
  1170. X
  1171. X
  1172. X
  1173. This manual is for GNUPLOT version 3.0.
  1174. .AB no
  1175. .AE
  1176. .LP
  1177. .nr HM 1.2i
  1178. .ds CH
  1179. .ds LH GNUPLOT 3.0
  1180. .ds RH %
  1181. .\".nr PS 12
  1182. .\".nr VS 13
  1183. SHAR_EOF
  1184. chmod 0644 gnuplot/docs/titlepage.ms ||
  1185. echo 'restore of gnuplot/docs/titlepage.ms failed'
  1186. Wc_c="`wc -c < 'gnuplot/docs/titlepage.ms'`"
  1187. test 599 -eq "$Wc_c" ||
  1188.     echo 'gnuplot/docs/titlepage.ms: original size 599, current size' "$Wc_c"
  1189. rm -f _shar_wnt_.tmp
  1190. fi
  1191. # ============= gnuplot/docs/doc2tex.c ==============
  1192. if test -f 'gnuplot/docs/doc2tex.c' -a X"$1" != X"-c"; then
  1193.     echo 'x - skipping gnuplot/docs/doc2tex.c (File already exists)'
  1194.     rm -f _shar_wnt_.tmp
  1195. else
  1196. > _shar_wnt_.tmp
  1197. echo 'x - extracting gnuplot/docs/doc2tex.c (Text)'
  1198. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/doc2tex.c' &&
  1199. /*
  1200. X * doc2tex.c  -- program to convert Gnuplot .DOC format to LaTeX document
  1201. X * Also will work for VMS .HLP files. 
  1202. X * Modified by Russell Lang from hlp2ms.c by Thomas Williams 
  1203. X * Extended by David Kotz to support quotes ("), backquotes, tables.
  1204. X *
  1205. X * usage:  doc2tex < file.doc > file.tex
  1206. X *
  1207. X *   where file.doc is a Gnuplot .DOC file, and file.tex will be an
  1208. X *     article document suitable for printing with LaTeX.
  1209. X *
  1210. X * typical usage for GNUPLOT:
  1211. X *
  1212. X *   doc2tex < gnuplot.doc > gnuplot.tex 
  1213. X *   latex gnuplot.tex ; latex gnuplot.tex
  1214. X */
  1215. X
  1216. static char rcsid[] = "$Id: doc2tex.c,v 1.1 90/01/11 15:44:06 dfk Exp Locker: dfk $";
  1217. X
  1218. #include <stdio.h>
  1219. #include <ctype.h>
  1220. #ifdef AMIGA_LC_5_1
  1221. #include <string.h>
  1222. #endif
  1223. X
  1224. #define MAX_NAME_LEN    256
  1225. #define MAX_LINE_LEN    256
  1226. #define TRUE 1
  1227. #define FALSE 0
  1228. X
  1229. typedef int boolean;
  1230. X
  1231. boolean intable = FALSE;
  1232. boolean verb = FALSE;
  1233. X
  1234. main()
  1235. {
  1236. X    init(stdout);
  1237. X    convert(stdin,stdout);
  1238. X    finish(stdout);
  1239. X    exit(0);
  1240. }
  1241. X
  1242. X
  1243. init(b)
  1244. FILE *b;
  1245. {
  1246. X    (void) fputs("\\input{titlepage.tex}\n",b);
  1247. }
  1248. X
  1249. X
  1250. convert(a,b)
  1251. X    FILE *a,*b;
  1252. {
  1253. X    static char line[MAX_LINE_LEN];
  1254. X
  1255. X    while (fgets(line,MAX_LINE_LEN,a)) {
  1256. X       process_line(line, b);
  1257. X    }
  1258. }
  1259. X
  1260. process_line(line, b)
  1261. X    char *line;
  1262. X    FILE *b;
  1263. {
  1264. X    switch(line[0]) {        /* control character */
  1265. X       case '?': {            /* interactive help entry */
  1266. X          break;            /* ignore */
  1267. X       }
  1268. X       case '@': {            /* start/end table */
  1269. X          if (intable) {
  1270. X             (void) fputs("\\hline\n\\end{tabular}\n", b);
  1271. X             (void) fputs("\\end{center}\n",b);
  1272. X             intable = FALSE;
  1273. X          } else {
  1274. X             if (verb) {
  1275. X                (void) fputs("\\end{verbatim}\n",b);
  1276. X                verb=FALSE;
  1277. X             } 
  1278. X             (void) fputs("\n\\begin{center}\n", b);
  1279. X             (void) fputs("\\begin{tabular}{|ccl|} \\hline\n", b);
  1280. X             intable = TRUE;
  1281. X          }
  1282. X          /* ignore rest of line */
  1283. X          break;
  1284. X       }
  1285. X       case '#': {            /* latex table entry */
  1286. X          if (intable)
  1287. X            (void) fputs(line+1, b); /* copy directly */
  1288. X          else
  1289. X            fprintf(stderr, "error: # line found outside of table\n");
  1290. X          break;
  1291. X       }
  1292. X       case '%': {            /* troff table entry */
  1293. X          break;            /* ignore */
  1294. X       }
  1295. X       case '\n':            /* empty text line */
  1296. X       case ' ': {            /* normal text line */
  1297. X          if (intable)
  1298. X            break;        /* ignore while in table */
  1299. X          if (line[1] == ' ') {
  1300. X             /* verbatim mode */
  1301. X             if (!verb) {
  1302. X                (void) fputs("\\begin{verbatim}\n",b);
  1303. X                verb=TRUE;
  1304. X             }
  1305. X             (void) fputs(line+1,b); 
  1306. X          } else {
  1307. X             if (verb) {
  1308. X                (void) fputs("\\end{verbatim}\n",b);
  1309. X                verb=FALSE;
  1310. X             } 
  1311. X             if (line[0] == '\n')
  1312. X               puttex(line,b); /* handle totally blank line */
  1313. X             else
  1314. X               puttex(line+1,b);
  1315. X          }
  1316. X          break;
  1317. X       }
  1318. X       default: {
  1319. X          if (isdigit(line[0])) { /* start of section */
  1320. X             if (!intable)    /* ignore while in table */
  1321. X               section(line, b);
  1322. X          } else
  1323. X            fprintf(stderr, "unknown control code '%c' in column 1\n", 
  1324. X                  line[0]);
  1325. X          break;
  1326. X       }
  1327. X    }
  1328. }
  1329. X
  1330. /* process a line with a digit control char */
  1331. /* starts a new [sub]section */
  1332. X
  1333. section(line, b)
  1334. X    char *line;
  1335. X    FILE *b;
  1336. {
  1337. X    static char string[MAX_LINE_LEN];
  1338. X    int sh_i;
  1339. X
  1340. X    if (verb) {
  1341. X       (void) fputs("\\end{verbatim}\n",b);
  1342. X       verb=FALSE;
  1343. X    } 
  1344. #ifdef AMIGA_LC_5_1
  1345. X    (void) sscanf(line,"%d",&sh_i);
  1346. X    strcpy(string,strchr(line,' ')+1);
  1347. X    {
  1348. X      char *p;
  1349. X      p = strchr(string,'\n');
  1350. X      if (p != NULL) *p = '\0';
  1351. X    }
  1352. #else
  1353. X    (void) sscanf(line,"%d %[^\n]s",&sh_i,string);
  1354. #endif
  1355. X    switch(sh_i)
  1356. X     {
  1357. X        case 1: 
  1358. X        (void) fprintf(b,"\\section{");
  1359. X        break;
  1360. X        case 2: 
  1361. X        (void) fprintf(b,"\\section{");
  1362. X        break;
  1363. X        case 3:
  1364. X        (void) fprintf(b,"\\subsection{");
  1365. X        break;
  1366. X        case 4: 
  1367. X        (void) fprintf(b,"\\subsubsection{");
  1368. X        break;
  1369. X        default:
  1370. X        case 5: 
  1371. X        (void) fprintf(b,"\\paragraph{");
  1372. X        break;
  1373. X     }
  1374. X    if (islower(string[0]))
  1375. X     string[0] = toupper(string[0]);
  1376. X    puttex(string,b);
  1377. X    (void) fprintf(b,"}\n");
  1378. }
  1379. X
  1380. /* put text in string str to file while buffering special TeX characters */
  1381. puttex(str,file)
  1382. FILE *file;
  1383. register char *str;
  1384. {
  1385. register char ch;
  1386. static boolean inquote = FALSE;
  1387. X
  1388. X     while( (ch = *str++) != '\0') {
  1389. X         switch(ch) {
  1390. X             case '#':
  1391. X             case '$':
  1392. X             case '%':
  1393. X             case '&':
  1394. X             case '_':
  1395. X             case '{':
  1396. X             case '}':
  1397. X                 (void) fputc('\\',file);
  1398. X                 (void) fputc(ch,file);
  1399. X                 break;
  1400. X             case '\\':
  1401. X                 (void) fputs("$\\backslash$",file);
  1402. X                 break;
  1403. X             case '~':
  1404. X                 (void) fputs("\\~{\\ }",file);
  1405. X                 break;
  1406. X             case '^':
  1407. X                 (void) fputs("\\verb+^+",file);
  1408. X                 break;
  1409. X             case '>':
  1410. X             case '<':
  1411. X             case '|':
  1412. X                 (void) fputc('$',file);
  1413. X                 (void) fputc(ch,file);
  1414. X                 (void) fputc('$',file);
  1415. X                 break;
  1416. X             case '"': 
  1417. X                 /* peek at next character: if space, end of quote */
  1418. X                 if (*str == NULL || isspace(*str) || ispunct(*str))
  1419. X                   (void) fputs("''", file);
  1420. X                 else
  1421. X                   (void) fputs("``", file);
  1422. X                 break;
  1423. X             case '`':    /* backquotes mean boldface */
  1424. X                 if (inquote) {
  1425. X                    fputs("}", file);
  1426. X                    inquote = FALSE;
  1427. X                 } else {
  1428. X                    fputs("{\\bf ", file);
  1429. X                    inquote = TRUE;
  1430. X                 }
  1431. X                 break;
  1432. X             default:
  1433. X                 (void) fputc(ch,file);
  1434. X                 break;
  1435. X         }
  1436. X     }
  1437. }
  1438. X
  1439. X
  1440. finish(b)
  1441. FILE *b;
  1442. {
  1443. X    (void) fputs("\\end{document}\n",b);
  1444. }
  1445. SHAR_EOF
  1446. chmod 0644 gnuplot/docs/doc2tex.c ||
  1447. echo 'restore of gnuplot/docs/doc2tex.c failed'
  1448. Wc_c="`wc -c < 'gnuplot/docs/doc2tex.c'`"
  1449. test 5029 -eq "$Wc_c" ||
  1450.     echo 'gnuplot/docs/doc2tex.c: original size 5029, current size' "$Wc_c"
  1451. rm -f _shar_wnt_.tmp
  1452. fi
  1453. # ============= gnuplot/docs/titlepage.tex ==============
  1454. if test -f 'gnuplot/docs/titlepage.tex' -a X"$1" != X"-c"; then
  1455.     echo 'x - skipping gnuplot/docs/titlepage.tex (File already exists)'
  1456.     rm -f _shar_wnt_.tmp
  1457. else
  1458. > _shar_wnt_.tmp
  1459. echo 'x - extracting gnuplot/docs/titlepage.tex (Text)'
  1460. sed 's/^X//' << 'SHAR_EOF' > 'gnuplot/docs/titlepage.tex' &&
  1461. \documentstyle[toc_entry]{article}
  1462. \setlength{\textwidth}{6.25in}
  1463. \setlength{\oddsidemargin}{0.5cm}
  1464. \setlength{\topmargin}{-0.5in}
  1465. \setlength{\textheight}{9in}
  1466. \setlength{\parskip}{1ex}
  1467. \setlength{\parindent}{0pt}
  1468. \adjustarticle
  1469. \begin{document}
  1470. X
  1471. \pagestyle{empty}
  1472. X   \rule{0in}{3in}
  1473. X   \begin{center}
  1474. SHAR_EOF
  1475. true || echo 'restore of gnuplot/docs/titlepage.tex failed'
  1476. fi
  1477. echo 'End of  part 10'
  1478. echo 'File gnuplot/docs/titlepage.tex is continued in part 11'
  1479. echo 11 > _shar_seq_.tmp
  1480. exit 0
  1481.  
  1482. exit 0 # Just in case...
  1483. -- 
  1484. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1485. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1486. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1487. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1488.