home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / maths / plplot / plplot_2 / FAQ < prev    next >
Text File  |  1994-09-05  |  49KB  |  990 lines

  1.  
  2. PLplot FAQ (Frequently Asked Questions)
  3. ---------------------------------------
  4.  
  5. This note contains answers to some Frequently Asked Questions (FAQ)
  6. regarding PLplot.  There is no particular order of topics at present.
  7.  
  8. Disclaimer:
  9.  
  10. The questions & answers that follow typically have been posed (and
  11. answered) to (by) me in email, and seem to me to be worthy of inclusion in
  12. a FAQ.  They may be out of date with respect to the current revision, or
  13. be otherwise suspect (misleading, incomplete, etc.).  Personal opinions
  14. may be contained within: this document is not to be considered the
  15. official opinion of the IFS or University of Texas or any other funding
  16. agency supporting this work.  Feel free to send comments or corrections to
  17. me (Maurice LeBrun) at mjl@dino.ph.utexas.edu.
  18.  
  19. Since I like the conventions of the CVS FAQ, I will adopt them here.  Each
  20. question in the table of contents will be given a change marker in the
  21. first column: 
  22.  
  23.     '-'    for a Question that has changed.
  24.     '='    for an Answer that has changed.
  25.     '#'    for an entry with changes to both Question and Answer.
  26.     '+'    for a newly added Question and Answer.
  27.  
  28. I will feel free to not mark trivial changes (misspellings, grammar, etc).
  29.  
  30. ==============================================================================
  31. Contents
  32. --------
  33.  
  34.  1. Installing PLplot
  35.  2. General features
  36.  3. X-based drivers (includes Tcl/TK, Tcl-DP)
  37.  4. All other drivers & supported platforms
  38.  
  39. ==============================================================================
  40. Section 1: Installing PLplot
  41.  
  42.  1.1  How do I build & install PLplot?
  43. =1.2  Where do I install PLplot?
  44.  1.3  Why should I use PLplot?
  45.  1.4  I don't have an ANSI compiliant C compiler.  How do I compile PLplot?
  46. =1.5  I don't have a fortran compiler; how do I compile PLplot?
  47. =1.6  The linker complains of unresolved functions atexit(), fsetpos(),
  48.       fgetpos(), and so on.
  49.  1.7  The compiler complains about the use of "malloc" or "size_t".
  50.  1.8  The compiler complains about "caddr_t" in one of the X support files.
  51.  1.9  configure script doesn't run correctly
  52. #1.10 (removed)
  53.  1.11 The linker complains that it can't resolve Tcl_AppInit. 
  54.  
  55. ==============================================================================
  56. Section 2: General features
  57.  
  58.  2.1  The manual doesn't mention capability...
  59.  2.2  How do I change to change the default background color?
  60.  2.3  I'm getting core dumps when calling a contour function from C.
  61.  2.4  Changing the default line width doesn't have any affect.
  62.  2.5  How can I generate more than 16 line colors?
  63.  2.6  What 2-d array organization am I supposed to use from C?
  64.  2.7  On stretched windows, the string characters look bad..
  65.  2.8  I would like to capture key sequences..
  66.  2.9  How can I get more information about the function/capability..
  67.  
  68. ==============================================================================
  69. Section 3: X-based drivers (includes Tcl/TK, Tcl-DP)
  70.  
  71. =3.1  Where do I get Tcl/TK or Tcl-DP?
  72. =3.2  How do I use "xauth"?
  73.  3.3  How do I use the Tcl/TK driver?
  74.  3.4  I've been having trouble getting the TK/TCL and PLplot working on...
  75. =3.5  I would like to issue a plot command, have the window appear,...
  76.  3.6  The X driver seems to run slower than on older versions of PLplot.
  77.  3.7  How do I change the title on the TK window menu bar, i.e...
  78.  3.8  I want to run plserver as a daemon...
  79.  3.9  Problems printing from the Tk driver..
  80.  3.10 Problems compiling xwin.c...
  81. +3.11 Problems saving files from the Tk driver.
  82.  
  83. ==============================================================================
  84. Section 4: All other drivers & supported platforms
  85.  
  86.  4.1  What about support for platform..
  87.  4.2  What about PLplot support for VMS?
  88.  4.3  PLplot is aborting with: Error opening plot data storage file.
  89.  4.4  Is there a Windows port of PLplot?
  90.  
  91. ==============================================================================
  92. Section 1: Installing PLplot
  93. ==============================================================================
  94.  
  95.  1.1  How do I build & install PLplot?
  96.  
  97. For a Unix-based system, read the file INSTALL in the distribution directory.
  98. Otherwise look at the system-dependent notes under sys/<system name>.
  99.  
  100.  
  101. =1.2  Where should I install PLplot?
  102.  
  103. There are two basic answers to this question: whereever you want, and
  104. whereever I want.
  105.  
  106. The configure script and Makefile are set up so that you can put the
  107. various components of PLplot virtually anywhere.  By default, it
  108. installs into a directory with the following subdirectories: 
  109.  
  110. bin       doc       examples  include   info      lib       tcl
  111.  
  112. As for the directory to install into, I recommend on Unix systems a
  113. directory just for PLplot.  On Unix systems, under /usr/local is a good
  114. place.  For one, it's not too difficult to get a system administrator to
  115. give you ownership of a directory somewhere in the public hierarchy.  On a
  116. smaller system, giving the package it's own directory helps maintain
  117. system integrity.  The paradigm of dropping everything under /usr/local
  118. (or even worse, /usr) makes everything simple to install initially but
  119. leads to a system that's difficult to organize and maintain.  There's
  120. the possibility for file name collisions -- stuff that isn't in your
  121. search path but needed anyway (readme, doc, and config files).  There's no
  122. way to cleanly & robustly back out the revision.  There's no way to tell
  123. where each file in /usr/local/bin (lib, etc) came from.
  124.  
  125. Any sufficiently large/complicated package has this problem.  Dedicating a
  126. directory tree is the only way to preserve the package's integrity.  The
  127. only good reason I've heard so far for NOT doing this (apart from laziness
  128. when installing) is that people then have to modify their search paths,
  129. etc, to use the new package.  Therefore, I've written a script that takes
  130. care of that.  Run docs/mklinks from the install directory, to install
  131. softlinks from the install directory into ../bin, ../lib, ../include, and
  132. ../man as appropriate.  Just as important, you can run it again TO
  133. COMPLETELY REMOVE THEM.  Thus it becomes trivial to install and back
  134. down a revision.  All software should work this way.
  135.  
  136. Note, I've written a similar script for Tcl/TK and extensions, called
  137. "installtk".  A copy is on harbor, but the current version of "mklinks"
  138. distributed with PLplot works with BOTH.  With this I've brought up and
  139. backed out a TK rev on several occasions, and found it immensely useful at
  140. the time, which is why I wrote it :-).  I think it is the most handy in
  141. two cases: 1) when developing using new betas, or 2) in a production
  142. environment, where you want to bring up a new package but still have the
  143. old one available in case programs break.  In the latter case, the only
  144. sensible scheme is to have the package in its own directory.
  145.  
  146. Now, if after all that you STILL want to break the package up, just set
  147. the appropriate shell variables for the install directories before running
  148. configure, in ~/config/cf_plplot.in (see configure notes).  That way you
  149. can put the docs, examples, and tcl files under $prefix/plplot, and
  150. everything else under $prefix/bin, $prefix/lib, $prefix/include,
  151. $prefix/man (imagine $prefix=/usr or $prefix=/usr/local and this will make
  152. perfect sense).  OK, there are no man pages yet, but there will be one of
  153. these days.
  154.  
  155.  
  156.  1.3  Why should I use PLplot?
  157.  
  158. This is probably the first question I was ever asked, and it continues
  159. to come up often enough to dwell on it a bit.
  160.  
  161. First off, my involvement with PLplot came from a very simple need: a
  162. portable, free, reasonable quality scientific graphics package.  At the
  163. time I had a 1 year fellowship in Japan, to continue my work on numerical
  164. simulation of plasmas.  Previous to this, I and my colleagues had
  165. laboriously translated the simulation code graphics to use two other
  166. libraries (one quasi-commercial and one PD), only to find both packages
  167. lacking in some important respects (most notably the PD one) and unable to
  168. easily (or cheaply) obtain the commercial one where I was working in
  169. Japan.  This was an extremely frustrating situation, which had always been
  170. apparent to me but only then came to a head.  Scientific graphics is an
  171. utter necessity to anyone doing numerical modeling, and I decided that
  172. being at the mercy of vendors and computer centers on this issue was
  173. unacceptable.  
  174.  
  175. I have no objection to commercial software, but let's face it.. sometimes
  176. commercial solutions suck.  This is one of those times.  You don't have
  177. access to the source code, so you can't improve it to suit your needs
  178. better, and you certainly can't freely carry it to different machines.
  179. Software environments on high-performance Unix systems, especially as
  180. regards commercial software, are VERY variable from machine to machine.
  181. Regardless of why this situation exists, I decided I could no longer
  182. depend on commercial software to provide a basic graphics capability.  I
  183. was somewhat familiar with PLplot for the Amiga, and seeing that it was
  184. fairly capable and portable I decided this would be the "last" graphics
  185. package I would use and support (for a long while at least).
  186.  
  187. It turned out that PLplot required some substantial investment of my time
  188. before it satisfied all of my (then) needs, but has nonetheless performed
  189. quite well.  In the interim I took over development for it from Tony
  190. Richardson.  The package has become almost trivially portable -- we can
  191. now get our codes running on a new machine in record time.  We can fix
  192. bugs in record time, although it doesn't always happen that way :-).
  193. Still, it takes less than a month or two for me to get around to fixing
  194. most bugs, which is better turnaround time than you typically get from
  195. vendors.  New features can be added with astonishing speed if the need
  196. (ours) is great enough.
  197.  
  198. So those are some of the reasons /I/ got involved, which may differ from
  199. those of the casual user.  Most people won't be digging into the source
  200. code to fix bugs, but it's very reassuring to know that you can if you
  201. need to.  I can't promise to support the package or make specific
  202. enhancements as my responsibilities (i.e. funding) lie elsewhere.  But I
  203. am always interested to hear what people want, since if it's a good idea I
  204. will benefit too.  User-contributed code is always welcomed (I have had
  205. quite a few).  And backward incompatibilities will be introduced into
  206. the package sparingly if at all.
  207.  
  208. The features supported by PLplot are necessarily fewer in number than a
  209. big commercial package.  PLplot has a fairly complete set of basic
  210. graphical capabilities, and a few very strong capabilities (e.g.  the
  211. Tcl/TK X-based GUI driver or its sibling the DP driver, the latter of
  212. which supports distributed rendering).  This has its good and bad points.
  213. The good part is that the library is relatively small, and can be modified
  214. without too much difficulty.  The disk space required is reasonable
  215. (especially if shared libraries are used), and the learning curve mild.
  216. The effort I might expend adhering to some large set of capabilities (many
  217. of which may be only rarely used; e.g. look at the GKS standard) can be
  218. focused instead on portability, user interface, and certain select
  219. capabilities.
  220.  
  221. On the other hand, there are many nice capabilities missing from PLplot at
  222. present, such as support for solid 3d modeling, postscript fonts, and so
  223. on.  New features are continually being added, but the fact remains that
  224. other more special purpose (and/or high priced) products will always have
  225. things that PLplot lacks (or do them better).  One way I see to fit PLplot
  226. in the overall software environment is to add more output drivers, both
  227. for generic file formats (e.g. GIF, CGM) as well as for specific graphics
  228. packages (e.g. AVS).  That way you could produce your graphics and view
  229. them using PLplot, dumping to disk those pages or plots you want to
  230. process using a separate package.  This can already be done using the XFig
  231. driver, for example.  For this to be most effective, PLplot should have
  232. internal knowlege of more varied objects than "line" (currently the
  233. fundamental unit), and I have some plans in this area.
  234.  
  235. I'm always interested in gaining new collaborators and contributors for
  236. PLplot, so feel free to send me email (mjl@dino.ph.utexas.edu) so we can
  237. discuss additions you'd like to make.  Want to help support PLplot but
  238. need suggestions?  I hesitate to recommend anything that will require
  239. broad changes to the package, but any of the following would be great:
  240.  
  241.     volunteers for target platform support (I have HPUX covered)
  242.     output drivers: GIF, CGM, others?
  243.     PLplot demos?  (especially using Tcl/TK)
  244.     an improved contour plotter
  245.     any interesting ideas/code for TK widgets for use with PLplot
  246.     anything from the ToDo list you'd like to tackle?
  247.     help rewriting the manual?  (OK, so I'm really reaching here)
  248.  
  249.  
  250.  1.4  I don't have an ANSI compiliant C compiler.  How do I compile PLplot?
  251.  
  252. Get an ANSI C compiler.  The cheap solution is to get gcc up if it has
  253. been ported to your machine.  This is not unreasonable IMHO -- the C
  254. standard was approved in 1989.  Isn't it about time you upgraded?
  255.  
  256.  
  257. =1.5  I don't have a fortran compiler; how do I compile PLplot?
  258.  
  259. The Fortran files are only part of the interface layer for Fortran codes
  260. that use PLplot.  If you don't need this capability the layer can be
  261. omitted by running configure with the --disable-f77 flag under Unix.
  262.  
  263. Alternately, you can use 'f2c' (freeware fortran-to-C translator) to
  264. compile the layer, assuming it (f2c) has been ported to your system.
  265.  
  266.  
  267. =1.6  The linker complains of unresolved functions atexit(), fsetpos(),
  268.       fgetpos(), and so on.
  269.  
  270. This is caused by a non-ANSI libc.  It /is/ possible to run PLplot on such
  271. a system, but at slightly reduced functionality -- I rely on ANSI libc
  272. functions both for seeking (fsetpos, fgetpos) and for cleanup (atexit),
  273. but neither is absolutely essential.  Currently the configure script
  274. should detect this condition automatically and make the necessary defines
  275. to avoid any problem.  If not, let me know and I will fix it.
  276.  
  277.  
  278.  1.7  The compiler complains about the use of "malloc" or "size_t".
  279.  
  280. Once upon a time, the source code went to some lengths to make sure
  281. these were properly prototyped/typedef'ed even on systems that weren't
  282. completely ANSI-compliant.  Now the code assumes they are in the usual
  283. places:
  284.  
  285.     malloc    should be declared in stdlib.h
  286.     size_t    should be typedef'ed in stdio.h (sometimes is in stdlib.h
  287.         also, and sometimes only in stdlib.h.  The latter is a
  288.         violation of the standard but I look for it there too.)
  289.  
  290. So when these are needed, stdio.h and/or stdlib.h are included.  If 
  291. this does not work on your system, there are two things to try.  First:
  292. fix the headers.  You can leave the current definition in place as 
  293. long as you "wrap" it, e.g.:
  294.  
  295. #  ifndef _SIZE_T
  296. #    define _SIZE_T
  297.      typedef unsigned int size_t;
  298. #  endif /* _SIZE_T */
  299.  
  300. Then add an identical declaration where it is *supposed* to be.  The
  301. second way is to hack plplot.h to explicitly prototype/typedef it.
  302.  
  303.  
  304.  1.8  The compiler complains about "caddr_t" in one of the X support files.
  305.  
  306. This is sometimes seen on systems that have X11R4 and claim POSIX
  307. conformance but that don't quite have their act together.  Typically on
  308. old versions of Unicos, Ultrix, and DGUX for example.  Currently the
  309. configure script determines whether caddr_t is typedef'ed, and if not,
  310. defines caddr_t appropriately.  Note that under POSIX.1, caddr_t is
  311. NOT supposed to be set.  But because of the various broken headers out
  312. there I compensate by defining it except when it is (illegally) already
  313. typedef'ed.  In any case, it should always work, and if not let me know.
  314.  
  315.  
  316.  1.9  configure script doesn't run correctly
  317.  
  318. The current configure script should work under even some very old versions
  319. of "sh".  But in the event of problems, look around for a different shell
  320. to run it under (posix shell, ksh, /bin/sh5, etc).
  321.  
  322. Be sure to check that the system name is being set correctly.  Your system
  323. must have the "uname" program.  If not, you can roll your own easily
  324. enough -- here's one for HPUX:
  325.  
  326. --cut-here--cut-here--cut-here--cut-here--cut-here--cut-here--cut-here-
  327. #!/bin/sh
  328. #
  329. #       File: uname
  330. #       Usage: uname
  331. #
  332. #       Minimal implementation of the uname command -- no arguments
  333. #       supported.
  334. #
  335. echo "HP-UX"
  336. --cut-here--cut-here--cut-here--cut-here--cut-here--cut-here--cut-here-
  337.  
  338. Alternately, you can explicitly set "system" either as a shell variable or
  339. in the defaults file.
  340.  
  341.  
  342. =1.10  (removed)
  343.  
  344.  
  345.  1.11 The linker complains that it can't resolve Tcl_AppInit. 
  346.  
  347. The Tcl7.0/TK3.3 and later libraries contain a function called "main".
  348. As a result, when linking you don't always get the correct main program.
  349.  
  350. This was done to make it easier to build custom versions of wish, so
  351. all you had to do is to create your own version of Tcl_AppInit, link
  352. with the library, and POOF! there is your modified wish.  Unfortunately
  353. it sometimes sends the fortran compiler / linker into spasms, because
  354. it gets the wrong main!  I have had exactly this problem under a 2-year
  355. old version of SunOS (but not under a more recent one), and couldn't
  356. get it to work despite varied link invocations.  BTW, I hear a similar
  357. problem exists under Linux from a C++ main.
  358.  
  359. My solution on these platforms was to recompile the tcl and tk libraries
  360. without the file including the main program (I think it was tclMain.o and
  361. tkMain.o).  I installed the new libraries as well as the separately compiled
  362. *Main.o's in case someone needed them.  No more problem with the Fortran
  363. compiler.
  364.  
  365. Another case where this may come up is using f2c to compile a Fortran
  366. main, in which case the true main is in libf2c.a.  In this case, putting
  367. -lf2c BEFORE -ltk -ltcl on the link line will usually do the trick.
  368.  
  369. ==============================================================================
  370. Section 2: General features
  371. ==============================================================================
  372.  
  373.  2.1  The manual doesn't mention capability..
  374.  
  375. The manual is waaay out of date.  Consult the last few update files to
  376. keep tabs of what's going on.  Take a look if there are are any
  377. substantial new capabilities in the example programs.  We went wild on the
  378. manual a while back, rewriting it in LaTeXinfo so that we could publish it
  379. in info file form.  That info file is available in the doc directory, but
  380. unfortunately (a) it still needs some polish and (b) it is still waaay out
  381. of date.  The next big push will see the end of it.
  382.  
  383.  
  384.  2.2  How do I change to change the default background color?
  385.  
  386. Use the -bg option.  Type plrender -h.
  387.  
  388.  
  389.  2.3  I'm getting core dumps when calling a contour function from C.
  390.  
  391. Aha.  Did you specify the minimum index as 1, not 0?  This is a leftover
  392. from when the package was written in Fortran, sigh.  I'm not sure why this
  393. isn't explained in the manual -- I just looked and there is no mention of
  394. it.  When I first got involved I mainly learned how to use the package
  395. from the demo programs and so didn't really notice the inconsistency.
  396. I've added some more explanatory error messages and will improve the
  397. document in this area.  Unfortunately it may be too late I think to change
  398. the minimum index to 0, since by now many people are used to this way.
  399. Maybe add some new function calls to fix up the API..
  400.  
  401.  
  402.  2.4  Changing the default line width doesn't have any effect.
  403.  
  404. Not all drivers support multiple line widths, in particular,
  405. pixel-oriented ones such as all the Tek drivers.  Further, it may not even
  406. mean the same thing from driver to driver.  If this ever becomes a serious
  407. enough inconvenience I may take a harder look at it.  One problem is that
  408. display devices typically don't have the resolution for resolving the
  409. difference between different line widths.  For example, you can output
  410. a plot using different line widths to a postscript file, and the lines
  411. don't appear any visibly thicker until you hit 5 or so (so 1-4 look the
  412. same, same for 5-8, and 9-10, or something like that).  The only real
  413. way to see the difference is to print it.  Another problem is that there
  414. may be no device support for multiple line widths.  In this case you
  415. can mock it up by drawing lines multiple times (very close together),
  416. but this is a real pain.
  417.  
  418. The driver does initialize the width to something reasonable, but only
  419. if the user hasn't already set it (i.e. it is zero).  The postscript
  420. driver uses a line width of 3 as a default, since this produces pretty
  421. good results.  
  422.  
  423.  
  424.  2.5  How can I generate more than 16 line colors?
  425.  
  426. You can use cmap1 to do it, via plcol1().  Each color will be interpolated
  427. along a piecewise linear curve in HLS space.  Eventually I will allow
  428. the user to ask for arbitrarily large palettes in cmap0 too, but it's
  429. not a high priority, since the smooth color variation supported by cmap1
  430. is often excellently suited to the task.
  431.  
  432.  
  433.  2.6  What 2-d array organization am I supposed to use from C?
  434.  
  435. The 2d array organization has an interesting history.  Back in plplot 2.6b
  436. all the C API functions that took 2d arrays used column dominant
  437. contiguous storage, while the corresponding Fortran API functions used row
  438. dominant contiguous storage (naturally).  The latter allocated temporary
  439. arrays and performed a transpose before calling the C API.  With plplot
  440. 3.0 Tony Richardson changed the C API to use arrays-of-arrays of pointers
  441. to increase performance on some platforms.  Unfortunately on high end
  442. platforms (vector machines or superscalar RISC workstations) performance
  443. can actually be worse as a result -- slowdowns due to memory access can be
  444. much worse than doing extra computation.  
  445.  
  446. As a result the situation re: 2d array organization in C became somewhat
  447. confusing -- now there was a /third/ type of array organization, or /four/
  448. if you want to count "normal" C array-of-pointers organization.  So I
  449. decided, years ago, that I wanted to have a general way of specifying
  450. array organization to be used by the 2d function API, with front-end
  451. routines used for converting from popular techniques.  But as it isn't so
  452. glamorous a pursuit, I've been slow to get it finished. :-\
  453.  
  454. The key idea is that for each major capability, there should exist a core
  455. function that takes the array in a totally arbitrary way -- as a function
  456. evaluator and its data.  This can be used directly if desired -- for
  457. example by a C++ user with his own matrix class.  However I also will
  458. provide front-end C API calls to handle the various popular 2d array
  459. organizations.  These front-ends merely pass in the appropriate function
  460. evaluator to the core routine, passing the user's array as data.  This
  461. results in calls like plfcont(), which is the core routine, and plcont1(),
  462. plcont2(), etc, which are the front-end routines.  
  463.  
  464. The core routine can do one of two things: it can either use function
  465. evaluations in place of the 2d array lookups in its computations, or
  466. create a temporary array in some standard internal format for its
  467. computations.  Both have their merits.  On low-end machines, the function
  468. evaluator approach is better (since there is little loss of pipelining and
  469. no temporary memory hit), while on high-end machines the reverse is true.
  470. On the other hand, on high-end machines the odds are better that you are
  471. spending most of the CPU time on things other than graphics, and
  472. efficiency is less important.  So I tend toward using the function
  473. evaluator where it is convenient.  In the contour plotter the function
  474. acceses are clear and it was easy to substitute a function evaluator.  In
  475. plshade, however, the code is a bit too involved for this to be done
  476. easily so instead I've gone the temporary array route.  Either way, as
  477. long as the API is put in place and documented, I can always go back and
  478. change things around internally later on.
  479.  
  480. My intentions right now is to give this a good look very soon, so that
  481. if I need to break the C API to make it more consistent, it happens
  482. before I release 5.0.
  483.  
  484.  
  485.  2.7  On stretched windows, the string characters look bad..
  486.  
  487. > - If I make a window of say y=100 and x=1000 the character are rather
  488. >   stretched. Is there a way to avoid this.
  489.  
  490. I haven't had the need for it and am barely familiar with how to do it.
  491. The best way to fix it won't happen until I support actual text by the
  492. driver, which is a long ways off yet.  But I think you can specify
  493. physical dimensions of your output device using plspage().  In fact,
  494. plspage() is called by the argument parser for the -geometry flag, but the
  495. options specifying physical dimensions -- xpmm and ypmm -- aren't filled
  496. in.  I can put changing this on my todo list.  But if it works, it will
  497. only work as long as the window isn't resized.
  498.  
  499. Eventually, the driver and internal page representation will be
  500. intelligent enough to support page resizing without changing the aspect
  501. ratios of certain objects such as characters, strings, fixed aspect
  502. viewports, etc.  But like I said, it's a way off.
  503.  
  504.  
  505.  2.8  I would like to capture key sequences..
  506.  
  507. >   Also, I would like to be able to capture the PF2 and PF4 keys. My
  508. >   application consistently uses these keys for particular responses. If
  509. >   I can catch them, the application can take appropriate action.
  510.  
  511. You can catch these now from C by installing a keyboard event handler,
  512. via the function:
  513.  
  514. /* Set the function pointer for the keyboard event handler */
  515.  
  516. void
  517. plsKeyEH(void (*KeyEH) (PLKey *, void *, int *), void *KeyEH_data);
  518.  
  519. You can look at the code in plrender as an example.  It uses a keyboard
  520. event handler in order to detect & act on page seeking commands.  It would
  521. be possible to mock something up for Fortran too if needed.  There is no
  522. problem with doing this from X since only a single key code is
  523. transmitted, but an xterm sends an escape sequence.  Your event handler
  524. would be called for each key code which makes recognition a bit harder but
  525. still doable (if in an xterm).  Let me know if this helps.
  526.  
  527.  
  528.  2.9  How can I get more information about the function/capability..
  529.  
  530. > I would like to be able to take advantage of the new routines that came
  531. > with 4.99g, but to do this I need to know the argument list that is
  532. > supplied to each one - the additional docs that came with 4.99g are very
  533. > sketchy on this.
  534. > I would particularly like to use plscmap1l, which I have had trouble
  535. > with,  also the following which are not explained:
  536. >  *      plwarn plexit plcol0 plcol1 plrgb plrgb1 plscolbg plscol0 plgcol0
  537. >  *      plscmap1 plscmap1f1 plscolor
  538. > Any details would be gratefully received.
  539.  
  540. Well for me to really explain would be basically the same as finishing the
  541. docs, which I don't have time for right now.  I suggest looking at the
  542. example programs and especially the source.  Now, I know that might not
  543. sound like fun, but some of the source code is a fairly easy read.  Look
  544. in "plplot.h" -- each function has a prototype that lists arguments and
  545. has a one-line description.  The description is usually an abbreviated
  546. version of the comments written with the function itself.  
  547.  
  548. If you are an emacs user, browsing the source code is very easy with
  549. 'tags'.  From the tmp directory, type 'etags *.c'.  Then edit plplot.h,
  550. move the cursor to the name of the function you are interested in, and
  551. type ESC-.  <poof>, you are there.  Happy hunting.
  552.  
  553. p.s. Some of the new capabilities are illustrated in C example programs
  554. but not Fortran, e.g. see x15c and x16c.  x17c isn't working yet.
  555.  
  556.  
  557. ==============================================================================
  558. Section 3: X-based drivers (includes Tcl/TK, Tcl-DP)
  559. ==============================================================================
  560.  
  561. =3.1  Where do I get Tcl/TK or Tcl-DP?
  562.  
  563. You can get the Tcl/TK package by anonymous ftp from sprite.berkeley.edu
  564. in the tcl subdirectory (or from harbor.ecn.purdue.edu in directory
  565. pub/tcl).  Also consult with the comp.lang.tcl newsgroup on Usenet.
  566. Tcl-DP can be obtained by anonymous ftp from mm-ftp.cs.berkeley.edu in
  567. pub/multimedia/Tcl-DP, and is highly recommended.  At the time of this
  568. writing, the versions that are fairly certain to work with PLplot are:
  569.  
  570. tcl7.3
  571. tk3.6
  572. tcl-dp3.1
  573. tcl-dp3.2 (has been tested under HPUX)
  574.  
  575. Earlier versions may be iffy. 
  576.  
  577. Note: the Tcl/TK, Tcl-DP header files should be found automatically by the
  578. configure script if they are in a relatively predictable location.  Many
  579. locations are checked; see cf/sysloc.in for more info.  If they aren't
  580. found on your system, consider: (a) moving them, (b) making softlinks to
  581. one of the searched-for locations, (c) if you REALLY think your location
  582. should be searched for automatically, feel free to ask me to change it.
  583.  
  584.  
  585. =3.2  How do I use "xauth"?
  586.  
  587. The 7.0/3.3 and later releases of Tcl/TK require xauth security in order
  588. to accept send requests.  The only problem is that you have to
  589. *completely* eliminate use of the older xhost method.  So typing "xhost -"
  590. isn't good enough -- you must also explicitly delete all the names from
  591. the xhost access list (type just "xhost" to see them).  That should do it
  592. for your local node.  To grant remote nodes access, just ftp your
  593. ~/.Xauthority file (server machine) to your remote home directory.  There
  594. are some notes on setting this up in the file Xauthority in the doc
  595. directory.
  596.  
  597. I know from experience that setting up and using xauth security can be
  598. a major pain in the neck.  For example, a site that's basically secure
  599. can be configured by the system manager to enable xhost access to all
  600. local nodes automatically through the /etc/X0.hosts file.  At such sites
  601. the users are unaccustomed to explicitly granting permission and on a
  602. secure group of machines there's no real security risk.  HOWEVER, a user
  603. may need to occasionally access an "outside" machine, and since you can't
  604. mix xhost and xauth, you are hosed.  And compiling TK without xauth
  605. security is a gargantuan, tremendous security hazard.  A sickeningly vile,
  606. disgusting mess.
  607.  
  608. Therefore I recommend that if you have any concerns about security or
  609. problems with TK send, and ESPECIALLY if you are running from some remote
  610. host, just forget about the TK driver altogether and use the DP driver
  611. instead.  The DP driver uses a much superior method of communication
  612. (sockets rather than X properties) and is distributable to boot.  It does
  613. have a slightly longer startup time.  If you are running on a machine off
  614. the network (where maybe you don't have a full TCP/IP implementation) the
  615. TK driver is fine.  The DP driver only allows open connects between the
  616. time it takes to launch the server and they do their initial handshaking,
  617. a hole that I view as impossible to take advantage of.
  618.  
  619.  
  620.  3.3  How do I use the Tcl/TK driver?
  621.  
  622. Get it going with the example programs, and play with it.  Read the online
  623. docs.
  624.  
  625.  
  626.  3.4  I've been having trouble getting the TK/TCL and PLplot working on
  627. my Indigo running IRIX 4.0.5. I got TCL7.0 and TK3.3 as advised and built the
  628. libraries and moved them to "/usr/lib" directory and then went about 
  629. (re)building PLplot. I then compiled the c-demos and ran them. The tk driver
  630. would pop up a window and disappear with the following complaints...
  631. ...
  632. >>Starting up ./plserver
  633. >>Server command "[list $plw_init $plwindow $client]" failed:
  634. >>         remote interpreter did not respond
  635. >>Program aborted
  636.  
  637. I think what is happening is that plserver is dumping core for some
  638. reason.  So why don't you get a "core dumped" message?  It has something
  639. to do with it being created through fork/exec from the TK driver.  Never
  640. quite knew what, but now that I am thinking about it once again I bet I
  641. know what the deal is.  It takes a little bit of time for it to dump core,
  642. and in that time the sending interpreter in the TK driver times out, and
  643. aborts.  Since the application is the parent process, once it exits you
  644. don't see any pending messages that the plserver (child) has.  In this
  645. circumstance I'm not sure if one should always get a core file or not.
  646.  
  647. So, the key is to find out why plserver is dumping core.  There are
  648. a few things you can do.  When you built Tcl/TK, did you run the tests?
  649. You need to type "make test" in either the tk3.3 or tcl7.0 directory, and
  650. it will merrily go on its way.  After you have done that, try cd'ing to
  651. the tk3.3/tests directory and running the tests using your installed
  652. version of wish.  Some of the tests will fail because "make test" actually
  653. compiles a custom version of wish with some extra functionality just for
  654. the test suite.  But most of the tests will do ok.  If not, you hosed
  655. the installation and that would explain the observed behavior.  If not
  656. we need to do some more hunting.  
  657.  
  658. Here are some more things to try: define DEBUG at the head of the files:
  659.  
  660.     plserver.c    (will give you information at startup)
  661.     tk.c        (this does the launching of plserver)
  662.  
  663. This should tell you at the very least if plserver is getting started
  664. correctly.  In addition, to get a whole LOT of output about the current
  665. state of the code, you can define also DEBUG_ENTER in:
  666.  
  667.     plserver.c
  668.     tk.c
  669.  
  670. and even:
  671.     plframe.c (also define DEBUG here, but be ready for lots of output)
  672.  
  673. The resulting messages often prove useful.
  674.  
  675.  
  676. =3.5  I would like to issue a plot command, have the window appear,
  677. or be re-painted, and allow the user to continue with command line operation
  678. of RLaB. I would like the user to be able to resize the window at any time
  679. or cover/un-cover it at any time and have it re-paint itself. The way  I 
  680. can get it to work is: the user issues plot command, window appears and is
  681. resizable, etc... the user must use the 3rd mouse button to "release" the
  682. window, after that control returns to the command line, but the window will
  683. no longer resize/repaint.
  684.  
  685. This is a feature, not a bug :-).
  686.  
  687. When the plotting package is waiting for the user to advance the page, it
  688. is actually waiting for any X event.  So events like refresh and resize
  689. get intercepted and processed.
  690.  
  691. Also during the normal course of plotting, the X server is periodically
  692. polled to find out if there are any events that need processing, and
  693. handles them if so.  I don't do this on every graphics instruction because
  694. otherwise the overhead is too large -- currently on every 20 line draws,
  695. every 10 polyline draws, and on every other call.
  696.  
  697. But once the user signals for the page advance, and control is returned to
  698. the user program, there is no way for the X driver to process any events
  699. simply because the control is in your program, not in the X driver.  The
  700. single-headedness of your process becomes the culprit here.  You can
  701. either sit in an event loop, or be doing user code specific things, but
  702. not both.  If you want to periodically tell the driver to handle pending
  703. events, there is an escape function call for that, but it's really just a
  704. bandaid solution.
  705.  
  706. The best solution is to fork off the rendering into a separate process,
  707. and this is just what I did with the Tcl/TK driver.  So, if you select
  708. the tk driver, your code can go about its merry way while the graphics
  709. window can be refreshed, resized, zoomed, printed, dumped, or whatever.
  710.  
  711. It'd also be a worthwhile project to split the X driver similarly, and
  712. there has been some interest in doing that (but I don't plan to work on
  713. it).
  714.  
  715.  
  716.  3.6  The X driver seems to run slower than on older versions of PLplot.
  717.  
  718. This may be caused by writing into the pixmap.  Each instruction is
  719. essentially done twice -- once to the screen and once to the offscreen
  720. pixmap.  I'm not happy about the tradeoff but there's not much that can be
  721. done.  With the pixmap, you get fast refreshes but slow draws, and the
  722. other way around without it.  What made me decide on using a pixmap as the
  723. default is the smooth scrolling that you can get (try a zoom followed by a
  724. scroll in the TK driver -- without writing into a pixmap the scrolling
  725. really sucks).  One way would be to write only to the pixmap and
  726. occasionally blit it to the screen, but that would be jerky and you'd have
  727. to worry about incomplete pages.  Try plotting with the -nopixmap option
  728. to see if that's any better.  I do almost all my PLplot X development on
  729. an HP 720 color console and graphics speed is usually not a problem :-).
  730.  
  731.  
  732.  3.7  How do I change the title on the TK window menu bar, i.e.,
  733.  
  734. >   Plot >> plclient_#2
  735. >            ^^^^
  736. >            I'd like this to read SuperCode
  737.  
  738. It uses the name of the main window if nothing else is set.  You can set
  739. it two ways.  One, use plParseOpts to parse your command line, then it
  740. will use argv[0] out of that list.  Two, just glom pls->program directly,
  741. via: 
  742.  
  743. #include <plstream.h>
  744.  
  745. PLStream *pls;
  746.  
  747. ...
  748.  
  749.     plgpls(&pls);
  750.     pls->program = "myprogram";
  751.  
  752. Yes, by this method you have access to the complete internal state of
  753. the current PLplot stream.  So be careful what you change :-).
  754.  
  755. There is one catch, though.  The way it is set up now it must be a unique
  756. name since it corresponds to your main window name (to which X property
  757. messages are sent).  If there is a previous Tcl interpreter of that name
  758. hanging around (say, as a result of some sort of abnormal exit like a core
  759. dump) you will get the mysterious _#2 appended (and _#3, and so on; note
  760. there are utilities [zapinterps or delinterp] that will delete these zombie
  761. interpreters).
  762.  
  763.  3.8  I want to run plserver as a daemon...
  764.  
  765. > What would be really desirable, would be to make plserver into an
  766. > actual daemon, as described in Stevens UNP.  Very cool idea, how
  767. > daemons work.  The plan would be to have a guy sitting there
  768. > monitoring a port/pipe/whatever, and when a connection request comes
  769. > in, he forks, and calls back to the app with directives to use a new,
  770. > previously unused (or reclaimed) port.  Then the daemon goes back to
  771. > listening.  That way, you could run multiple apps simultaneously, each
  772. > getting a new plserver if a spare one isn't already available...
  773. > I think the default action would be that when you punch >> on the last
  774. > plot, the client goes ahead and terminates, but plserver stays up, for
  775. > future invocations.  But when the user wants to get rid of it, if he
  776. > doesn't plan to plot for a while, then there's a kill/off button
  777. > somewhere on the pannel.
  778.  
  779. Actually it is possible now to start up a plserver and connect to it,
  780. using the DP driver.  But one of the problems with this is the security
  781. issue.  I get around the problem now by only allowing connects during
  782. the brief time between the fork/exec and when the connection succeeds.
  783. If it was open for longer we run into the same old possibility for
  784. nasty interpreter commands being sent.  Dunno if there's a good way
  785. around this.
  786.  
  787.  
  788.  3.9  Problems printing from the Tk driver..
  789.  
  790. > We're having some big problems with the latest release of PLPLOT.
  791. > Basically, we can't print and we can't save Postscript files. When we
  792. > try to print we get
  793. > *** PLPLOT ERROR ***
  794. > process_next: Unrecognized command
  795. > Program aborted
  796. > lpr: standard input: empty input file
  797.  
  798. Interesting.  Sounds like maybe an incompatibility with the plplot library
  799. output and plrender [note: turns out it was indeed a previous version of
  800. plrender in the user's search path].  The 'print' command saves the page
  801. as a plplot metafile, and then invokes plrender to turn it into
  802. postscript.  Either it was installed incorrectly, or (more likely), it is
  803. a bug.  I have printed plots by this method without problem since the
  804. 4.99g release, but probably I didn't exercise everything.  Maybe try "Save
  805. As.." with a variety of file types and see if anything turns out.  
  806.  
  807. > I have my PRINTER environment variable set. Am I supposed to do
  808. > something else?  As for saving Postscript files, it seems to write part
  809. > of the file and then just stop in the middle. It appears that some
  810. > buffer is not getting flushed.  Any ideas?
  811.  
  812. Take a look at the plpr script, it is braindead, but I never had much time
  813. to embellish it.  It doesn't allow you to set a particular printer, which
  814. I guess is what you want.  You can always edit the file, for site-wise
  815. customization.  Of course, this sucks, but is the best I have for now.
  816. Isn't "lpr" supposed to obey the setting of PRINTER?  Even if so/not,
  817. there's the question of how to render the saved metafile.  I use mono ps,
  818. since that's usually what people want.  But sometimes I've wanted to print
  819. grayscale output, and hit print without thinking, and got a nice,
  820. completely black, plot. :-) So not only do I have to provide for a way to
  821. select this in the GUI but also a way to read customized settings
  822. automatically at startup.  Which brings up init file issues.. (see the
  823. ToDo file).
  824.  
  825. So for now just modify plpr to your tastes and stick it in your path :-).
  826. It should be located BEFORE the installed copy of plpr, which should just
  827. be the site-wise default.  I usually have ~/bin before most significant
  828. directories in my path anyway.  The exec() call used to invoke it does use
  829. your path I believe.  And if you embellish it significantly, feel free to
  830. send me a copy.
  831.  
  832.  
  833.  3.10 Problems compiling xwin.c...
  834.  
  835. > I am trying to install PLPLOT on a DECstation 5000/240 running Ultrix
  836. > 4.2a and an earlier version of X11R4. I am using gcc with the -ansi
  837. > option.  Running make gives me the following errors:
  838. > In file included from xwin.c:50:
  839. > /usr/local/lib/gcc-lib/decstation-ultrix4.2a/2.4.5/include/X11/Xlib.h:3958: parse error before `XSizeHints'
  840.  
  841. After poking around some on this system I found out that the header files
  842. were hosed.  This is the kind of thing that crops up only when using an
  843. ANSI compiler or C++ since it's in the function prototypes.  In
  844. particular, Xlib.h uses XSizeHints before it's defined (in Xutil.h).  In
  845. the X11R5 header files from HP-UX, all of the functions needing to
  846. reference a variable of type XSizeHints* are prototyped in Xutil.h, after
  847. the declaration of XSizeHints.  
  848.  
  849. I don't know how many systems I've seen with broken X11R4 header files --
  850. a lot.  Seems the X11R4 distribution was partly to blame, but you'd think
  851. the vendor would have at least checked to see whether an ANSI C compiler
  852. would work with them.  In any case, there /should/ be an upgrade to fix
  853. problems like this.  At worst, you can pull over a later X11 distribution
  854. (as I write this X11R6 just came out) and build it yourself.  I do know
  855. that some PLplot runs OK on some Ultrix systems so there should be an
  856. upgrade available.  
  857.  
  858.  
  859. +3.11 Problems saving files from the Tk driver.
  860.  
  861. > When I tried to save
  862. > the .ps files (both color and mono) using "Save as.." in plrender,
  863. > it doesn't seem to terminate the file properly. I had to add a
  864. > "showpage" statement at the end before I send it to the printer 
  865. > in order for my printer to print it properly. On the other hand, if
  866. > I select the drivers (ps or psc) at the command line or upon start
  867. > of the program, the output files looked fine. 
  868.  
  869. You either need to quit the program or pick "save close" before displaying
  870. the saved file.  This is because "save as" leaves the file open so that
  871. you can use "save" on multiple plots, each going to the same file.
  872.  
  873.  
  874.  
  875. ==============================================================================
  876. Section 4: All other drivers & supported platforms
  877. ==============================================================================
  878.  
  879.  4.1  What about support for platform..
  880.  
  881. Right now the package is most likely to be up-to-date under HP-UX and
  882. Linux, since those are the two systems used most extensively by Maurice
  883. and Geoff.  However we also use SunOS, AIX, UNICOS, and SUPER-UX enough
  884. that probably there will be no problems on those systems also.  The DOS
  885. and OS/2 support is being done mostly by other parties at this point (see
  886. the README).  Any other systems are suspect.  Other Unix variants (IRIX,
  887. OSF/1) are reasonably safe since the PLplot configure script is fairly
  888. sophisticated and portable -- system dependencies tend to drop out without
  889. notice.  I can't make any promises as to the Amiga support since I rarely
  890. compile PLplot there these days.  Also no one is currently supporting the
  891. NeXT.  As always, I'm looking for volunteers to help pick up the slack on
  892. these systems (really, any other than say HPUX and Linux).  At the minimum
  893. this means getting pre-beta releases and testing them, submitting any
  894. fixes that need to be made, that's it!  If you have more ambitious plans
  895. for supporting a particular platform, that'd be great -- let me know.
  896.  
  897.  
  898.  4.2  What about PLplot support for VMS?
  899.  
  900. It's true, I did support PLplot under VMS at one time, although I never
  901. DID see the X driver running on it (supposedly it did).  However after
  902. exclusively using a fast Unix workstation for a while I vowed never to go
  903. back to VMS :-).  The VMS PLplot port caused me lots of pain to get up,
  904. but at least I learned a few things about portability.  Anyway, there may
  905. still be people out there who would find it useful under VMS, so if anyone
  906. succeeds in making PLplot work and want to continue supporting it there,
  907. the job is yours for the asking.  I don't have the time or patience for
  908. it.
  909.  
  910.  
  911.  4.3  PLplot is aborting with: Error opening plot data storage file.
  912.  
  913. The most common reason I've seen for this is that the temporary file area
  914. is set up incorrectly (wrong permissions).  Note: this directory is where
  915. tmpfile() opens its temporaries, which may NOT be /tmp.  You can find the
  916. true location typically by looking in stdio.h.  For example, on my HP
  917. in stdio.h there is:
  918.  
  919. #  define _P_tmpdir "/usr/tmp/"
  920.  
  921. look for something similar on your machine, and make sure the directory
  922. has the appropriate permissions (it should have global write set).
  923.  
  924.  
  925.  4.4  Is there a Windows port of PLplot?
  926.  
  927. Look under sys/dos/bcc, there you'll see a file win3.c, which is a Windows
  928. port by Paul Casteels.  I don't know much about it having never tried it,
  929. but have heard some good comments about it.  One nice enhancement is the
  930. ability to print the current plot.
  931.  
  932.  
  933.  4.5  I'd like to develop a windowed interface to PLplot for..
  934.  
  935. For the systems that I've used, developing windowed interfaces is a fair
  936. amount of work.  Most of my experience developing graphical interfaces is
  937. under Unix (and a little on the Amiga).  Unix/X/Tcl/Tk on a fast
  938. workstation makes for an excellent starting point -- it is powerful, and
  939. the final product is fairly portable.  Virtually all my professional work
  940. is on Unix machines, which also drives my effort -- the Tk driver is where
  941. most of my attention has been going.  But it's still a /lot/ of work.
  942.  
  943. Of course there are still many reasons for using or developing on a
  944. microcomputer -- if I used my Amiga more I'd be more inclined to spend
  945. more time improving the interface there.  As it was, the Amiga had the
  946. first PLplot windowed interface, and it gave me many ideas about how to
  947. proceed with the Tk one.  Unfortunately, too many of these features were
  948. built into the Amiga screen driver instead of the core, and didn't help
  949. directly when I was doing the Tk driver.  So when I improved the package
  950. in order to support the Tk driver I tried to make changes where they could
  951. potentially benefit other windowing drivers.  This should help developers
  952. of other windowed drivers some.
  953.  
  954. I originally started developing a Motif-based driver, but abandoned the
  955. effort when I saw how much easier Tk-based ones are to construct (and Tk
  956. is free to boot).  At this point I'm very happy with Tcl/TK and am
  957. probably finished with Motif.  There are still some reasons for going with
  958. Motif -- such as needing a specific Motif widget or to satisfy company
  959. policy, market demand, or whatever.  Also the recent development of
  960. interpretive Motif environments that rival Tcl/TK in their ease of use and
  961. prototyping speed (or so I've heard) makes Motif-based GUI construction
  962. more palatable.  If you just want Motif widgets inside your app, you can
  963. do this in Tk (see the comp.lang.tcl FAQ for more info).  Right now there
  964. is no way to do the reverse as far as I know -- include Tk widgets inside
  965. a Motif app, but maybe eventually there will be a way (I mention this
  966. because the development of the plframe widget was the most time-consuming
  967. single thing I've done as regards PLplot).
  968.  
  969. Under Windows, try the driver by Paul Casteels (see FAQ 4.4).  At the time
  970. of this writing it is still somewhat sparse, but as per the comments above
  971. it may not be unreasonable to extend it in the same directions as the Tk
  972. driver.  Another alternative is to actually use Tk -- there are several
  973. ports of Tk to Windows in various stages of completion.  I'd like to hear
  974. about people's experiences with these, especially with PLplot.
  975.  
  976. I've been asked several times about a Mac interface.  There was supposedly
  977. a port of PLplot to the Mac some time back, but I never even saw it.  I
  978. don't know beans about programming the Mac, so if some one /else/ wants
  979. to investigate and let me know the status I will include it here.
  980.  
  981.  
  982. ==============================================================================
  983.