-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFAQ
1696 lines (1348 loc) · 78.9 KB
/
FAQ
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
This is a rather old FAQ, but start looking for your questions here, anyway.
PLplot FAQ (Frequently Asked Questions)
---------------------------------------
This note contains answers to some Frequently Asked Questions (FAQ)
regarding PLplot.
Disclaimer:
The questions & answers that follow typically have been posed (and answered)
in email, and seem to me to be worthy of inclusion in a FAQ. They may be
out of date with respect to the current revision, or be otherwise suspect
(misleading, incomplete, etc.), and the original authors of both the
question and answer have not been retained (most of the answers come from
Maurice, some from Geoff, and the rest from various people on the mailing
list). Personal opinions may be contained within: this document is not to
be considered the official opinion of the IFS or University of Texas or any
other funding agency supporting this work. Feel free to send comments or
corrections to [email protected] (Maurice LeBrun) or
[email protected] (Geoff Furnish).
The conventions of the CVS FAQ are adopted here. Each question in the
table of contents will be given a change marker (for non-trivial changes)
in the first column:
'-' for a Question that has changed.
'=' for an Answer that has changed.
'#' for an entry with changes to both Question and Answer.
'+' for a newly added Question and Answer.
==============================================================================
Contents
--------
1. Building/installing PLplot
2. Philosophy, future directions, broad capabilities, etc.
3. Specific features/capabilities
4. X-based drivers (includes Tcl/TK, Tcl-DP)
5. All other drivers & supported platforms
==============================================================================
Section 1: Building/installing PLplot
1.1 How do I build & install PLplot?
1.2 Where do I install PLplot?
1.3 (moved)
1.4 I don't have an ANSI compiliant C compiler. How do I compile PLplot?
1.5 I don't have a fortran compiler; how do I compile PLplot?
1.6 The linker complains of unresolved functions atexit(), fsetpos(),
fgetpos(), and so on.
1.7 The compiler complains about the use of "malloc" or "size_t".
=1.8 The compiler complains about "caddr_t" in one of the X support files.
1.9 configure script doesn't run correctly
1.10 (removed)
1.11 The linker complains that it can't resolve Tcl_AppInit.
+1.12 Can the library place be changed *after* compilation, say, by an
environment variable ?
+1.13 tcpip.c won't compile.
==============================================================================
Section 2: Philosophy, future directions, broad capabilities, etc.
2.1 Why should I use PLplot?
+2.2 Could you comment on the pros and cons of plplot and gnuplot?
+2.3 How do I use PLplot to do interactive plotting?
+2.4 What is RLaB?
+2.5 Why should I use Tcl?
+2.6 What are some of the planned enhancements to the PLplot interactive
capabilities?
+2.7 Is there a PLplot newsgroup?
==============================================================================
Section 3: Specific features/capabilities
3.1 The manual doesn't mention capability...
=3.2 How do I change the default background color?
3.3 I'm getting core dumps when calling a contour function from C.
3.4 Changing the default line width doesn't have any affect.
3.5 How can I generate more than 16 line colors?
3.6 What 2-d array organization am I supposed to use from C?
3.7 On stretched windows, the string characters look bad..
3.8 I would like to capture key sequences..
-3.9 How to get more information about a function or capability.
+3.10 What are the keyboard controls in the graphics window?
+3.11 How do I get the value of a PLplot internal variable?
+3.12 I'm getting "Unable to delete command .dx.gq1" when I use a matrix.
+3.13 My matrix'es are being deleted while in use from itcl.
+3.14 I'm getting a "already exists" message when creating a tclMatrix.
==============================================================================
Section 4: X-based drivers (includes Tcl/TK, Tcl-DP)
=4.1 Where do I get Tcl/TK or Tcl-DP?
4.2 How do I use "xauth"?
4.3 How do I use the Tcl/TK driver?
4.4 I've been having trouble getting the TK/TCL and PLplot working on...
4.5 I would like to issue a plot command, have the window appear,...
4.6 The X driver seems to run slower than on older versions of PLplot.
4.7 How do I change the title on the TK window menu bar, i.e...
-4.8 How do I run plserver as a daemon?
4.9 Problems printing from the Tk driver..
4.10 Problems compiling xwin.c...
4.11 Problems saving files from the Tk driver.
+4.12 Why does the Tcl/TK driver use a separate process for rendering but
not the X driver?
+4.13 How do I create an interactive, widget-based application using PLplot?
+4.14 How do I shade between a 4 color range with the Tk driver?
==============================================================================
Section 5: All other drivers & supported platforms
5.1 What about support for platform..
=5.2 What about PLplot support for VMS?
5.3 PLplot is aborting with: Error opening plot data storage file.
5.4 Is there a Windows port of PLplot?
+5.5 I'd like to develop a windowed interface to PLplot for..
+5.6 What about PLplot support for the Mac?
+5.7 What about PLplot support for OS/2?
==============================================================================
Section 1: Installing PLplot
==============================================================================
1.1 How do I build & install PLplot?
For a Unix-based system, it is usually as easy as typing 'configure', then
'make', then 'make install'. However I strongly recommend that you first
read the file INSTALL in the distribution directory. For non-Unix systems,
look at the system-dependent notes under sys/<system name>.
1.2 Where should I install PLplot?
The configure script and Makefile are set up so that you can put the
various components of PLplot virtually anywhere. By default, it installs
into a directory with the following subdirectories:
bin doc examples include info lib tcl
On Unix systems I recommend using a directory just for PLplot. Somewhere
under /usr/local is a good place. For one, it's not too difficult to get
a system administrator to give you ownership of a directory somewhere in
the public hierarchy. On a smaller system, giving the package its own
directory helps maintain system integrity. The practice of dropping
everything into /usr/local/bin, /usr/local/lib and so on (or even worse,
/usr/bin, /usr/lib, etc) makes everything simple to install initially but
leads to a system that's difficult to organize and maintain. There's the
possibility for file name collisions -- stuff that isn't in your search
path but needed anyway (readme, doc, and config files). There's no way to
cleanly & robustly back out the revision. There's no way to tell where
each file in /usr/local/bin (lib, etc) came from.
Any sufficiently large/complicated package has this problem. Dedicating a
directory tree is a good way to preserve the package's integrity. The only
good reason I've heard so far for NOT doing this (apart from laziness when
installing) is that people then have to modify their search paths and other
settings to use the new package. Therefore, I've written a script that
takes care of that. Run doc/mklinks from the install directory, to create
softlinks from the install directory into ../bin, ../lib, ../include, and
../man as appropriate. Just as important, you can run it again TO
COMPLETELY REMOVE THEM. Thus it becomes trivial to install and back down a
revision. All software should work this way.
Note, I've written a similar script for Tcl/TK and extensions, called
"installtk". A copy is on harbor, but the current version of "mklinks"
distributed with PLplot works with BOTH. With this I've brought up and
backed out a TK rev on several occasions, and found it immensely useful at
the time, which is why I wrote it :-). I think it is the most handy in
two cases: 1) when developing using new betas, or 2) in a production
environment, where you want to bring up a new package but still have the
old one available in case programs break. In the latter case, the only
sensible scheme is to have the package in its own directory.
Now, if after all that you STILL want to break the package up, just set
the appropriate shell variables for the install directories before running
configure, in ~/config/cf_plplot.in (see configure notes). That way you
can put the docs, examples, and tcl files under e.g. $prefix/plplot, and
everything else under $prefix/bin, $prefix/lib, $prefix/include,
$prefix/man (imagine $prefix=/usr or $prefix=/usr/local and this will make
perfect sense). OK, there are no man pages yet, but there will be one of
these days.
1.3 (moved)
1.4 I don't have an ANSI compiliant C compiler. How do I compile PLplot?
Get an ANSI C compiler. The cheap solution is to get gcc up if it has
been ported to your machine. This is not unreasonable IMHO -- the C
standard was approved in 1989. Isn't it about time you upgraded?
1.5 I don't have a fortran compiler; how do I compile PLplot?
The Fortran files are only part of the interface layer for Fortran codes
that use PLplot. If you don't need this capability the layer can be
omitted by running configure with the --disable-f77 flag under Unix.
Alternately, you can use 'f2c' (freeware fortran-to-C translator) to
compile the layer, assuming it (f2c) has been ported to your system.
1.6 The linker complains of unresolved functions atexit(), fsetpos(),
fgetpos(), and so on.
This is caused by a non-ANSI libc. It /is/ possible to run PLplot on such
a system, but at slightly reduced functionality -- I rely on ANSI libc
functions both for seeking (fsetpos, fgetpos) and for cleanup (atexit),
but neither is absolutely essential. Currently the configure script
should detect this condition automatically and make the necessary defines
to avoid any problem. If not, let me know and I will fix it.
1.7 The compiler complains about the use of "malloc" or "size_t".
Once upon a time, the source code went to some lengths to make sure
these were properly prototyped/typedef'ed even on systems that weren't
completely ANSI-compliant. Now the code assumes they are in the usual
places:
malloc should be declared in stdlib.h
size_t should be typedef'ed in stdio.h (sometimes is in stdlib.h
also, and sometimes only in stdlib.h. The latter is a
violation of the standard but I look for it there too.)
Since most of the PLplot source files need something from either stdio.h
or stdlib.h, I include them both. If this does not work on your system,
there are two things to try. First: fix the headers. You can leave the
current definition in place as long as you "wrap" it, e.g.:
# ifndef _SIZE_T
# define _SIZE_T
typedef unsigned int size_t;
# endif /* _SIZE_T */
Then add an identical declaration where it is *supposed* to be. The
second way is to hack plplot.h to explicitly prototype/typedef it.
=1.8 The compiler complains about "caddr_t" in one of the X support files.
This is sometimes seen on systems that have X11R4 and claim POSIX
conformance but that don't quite have their act together. Typically on old
versions of Unicos, Ultrix, and DGUX for example. Currently the configure
script determines whether caddr_t is typedef'ed, and if not, typedefs
caddr_t appropriately. Note that under POSIX.1, caddr_t is NOT supposed to
be set. But because of the various broken headers out there I compensate by
typedef'ing it except when it is (illegally) already typedef'ed (note: at
least some versions of gcc perform the same "fix"). In any case, it should
always work, and if not let me know.
1.9 configure script doesn't run correctly
The current configure script should work under even some very old versions
of "sh". But in the event of problems, look around for a different shell
to run it under (posix shell, ksh, /bin/sh5, etc).
Be sure to check that the system name is being set correctly. Your system
must have the "uname" program. If not, you can roll your own easily
enough -- here's one for HPUX:
--cut-here--cut-here--cut-here--cut-here--cut-here--cut-here--cut-here-
#!/bin/sh
#
# File: uname
# Usage: uname
#
# Minimal implementation of the uname command -- no arguments
# supported.
#
echo "HP-UX"
--cut-here--cut-here--cut-here--cut-here--cut-here--cut-here--cut-here-
Alternately, you can explicitly set "system" either as a shell variable or
in the defaults file.
1.10 (removed)
1.11 The linker complains that it can't resolve Tcl_AppInit.
The Tcl7.0/TK3.3 and later libraries contain a function called "main".
As a result, when linking you don't always get the correct main program.
This was done to make it easier to build custom versions of wish, so
all you had to do is to create your own version of Tcl_AppInit, link
with the library, and POOF! there is your modified wish. Unfortunately
it sometimes sends the fortran compiler / linker into spasms, because
it gets the wrong main! I have had exactly this problem under a 2-year
old version of SunOS (but not under a more recent one), and couldn't
get it to work despite varied link invocations. BTW, I hear a similar
problem exists under Linux from a C++ main.
My solution on these platforms was to recompile the tcl and tk libraries
without the file including the main program (I think it was tclMain.o and
tkMain.o). I installed the new libraries as well as the separately compiled
*Main.o's in case someone needed them. No more problem with the Fortran
compiler.
Another case where this may come up is using f2c to compile a Fortran
main, in which case the true main is in libf2c.a. In this case, putting
-lf2c BEFORE -ltk -ltcl on the link line will usually do the trick.
+1.12 Can the library place be changed *after* compilation, say, by an
environment variable ?
The environment variable "PLPLOT_HOME" may be used to override the
default installation place such that
${PLPLOT_HOME}/bin is the binaries' location
${PLPLOT_HOME}/lib is the library/fonts location
if you only need to override a single value, the environment variables
"PLPLOT_BIN" and "PLPLOT_LIB" may be used to individually specify the
locations of the binaries and of the library/fonts, respectively.
So that in your case, setting PLPLPOT_LIB might be enough.
Below is a "cutting" from plctrl.c
/*----------------------------------------------------------------------*\
* char *plFindCommand
*
* Looks for the specified executable file. Search path:
* current directory
* PLPLOT_HOME_ENV/bin = $(PLPLOT_HOME)/bin
* BIN_DIR
*
* The caller must free the returned pointer (points to malloc'ed memory)
* when finished with it.
\*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*\
* FILE *plLibOpen(fn)
*
* Return file pointer to lib file.
* Locations checked:
* PLPLOT_LIB_ENV = $(PLPLOT_LIB)
* current directory
* PLPLOT_HOME_ENV/lib = $(PLPLOT_HOME)/lib
* LIB_DIR
* PLLIBDEV
\*----------------------------------------------------------------------*/
+1.13 tcpip.c won't compile.
Probably a header file problem. For example, under some versions of Linux,
the compile fails with optimization on. The header file stdlib.h is busted.
Either fix the header file, turn off optimization, or put -U__OPTIMIZE__ on
the compile line (best).
==============================================================================
Section 2: Philosophy, future directions, broad capabilities, etc.
==============================================================================
2.1 Why should I use PLplot?
This is probably the first question I was ever asked, and it continues
to come up often enough to dwell on it a bit.
First off, my involvement with PLplot came from a very simple need: a
portable, free, reasonable quality scientific graphics package. At the
time I had a 1 year fellowship in Japan, to continue my work on numerical
simulation of plasmas. Previous to this, I and my colleagues had
laboriously translated the simulation code graphics to use two other
libraries (one quasi-commercial and one PD), only to find both packages
lacking in some important respects (most notably the PD one) and unable to
easily (or cheaply) obtain the commercial one where I was working in
Japan. This was an extremely frustrating situation, which had always been
apparent to me but only then came to a head. Scientific graphics is an
utter necessity to anyone doing numerical modelling, and I decided that
being at the mercy of vendors and computer centers on this issue was
unacceptable.
I have no objection to commercial software, but let's face it.. sometimes
commercial solutions suck. This is one of those times. You don't have
access to the source code, so you can't improve it to suit your needs
better, and you certainly can't freely carry it to different machines.
Software environments on high-performance Unix systems, especially as
regards commercial software, are VERY variable from machine to machine.
Regardless of why this situation exists, I decided I could no longer
depend on commercial software to provide a basic graphics capability. I
was somewhat familiar with PLplot for the Amiga, and seeing that it was
fairly capable and portable I decided this would be the "last" graphics
package I would use and support (for a long while at least).
It turned out that PLplot required some substantial investment of my time
before it satisfied all of my (then) needs, but has nonetheless performed
quite well. In the interim I took over development for it from Tony
Richardson. The package has become almost trivially portable -- we can
now get our codes running on a new machine in record time. We can fix
bugs in record time, although it doesn't always happen that way :-).
Still, it takes less than a month or two for me to get around to fixing
most bugs, which is better turnaround time than you typically get from
vendors. New features can be added with astonishing speed if the need
(ours) is great enough.
So those are some of the reasons /I/ got involved, which may differ from
those of the casual user. Most people won't be digging into the source
code to fix bugs, although it's very reassuring to know that you can if
you need to. I can't promise quick bug fixes or specific enhancements as
my responsibilities (i.e. funding) lie elsewhere. But I am always
interested to hear what people want, since if it's a good idea I will
benefit too. User-contributed code is always welcomed (there has been
quite a bit). And backward incompatibilities will be introduced into the
package sparingly if at all.
The features supported by PLplot are necessarily fewer in number than a
big commercial package. PLplot has a fairly complete set of basic
graphical capabilities, and a few very strong capabilities (e.g. the
Tcl/TK "plframe" plotting widget, and the GUI drivers built around it).
This has its good and bad points. The good part is that the library is
relatively small, and can be modified without too much difficulty. The
disk space required is reasonable (especially if shared libraries are
used), and the learning curve mild. The effort I might expend adhering to
some large set of capabilities (many of which may be only rarely used;
e.g. look at the GKS standard) can be focused instead on portability, user
interface, and certain select capabilities that I and my colleagues find
important.
On the other hand, there are many nice capabilities missing from PLplot at
present, such as support for solid 3d modelling or postscript fonts, just
to name two. New features are continually being added, but the fact
remains that other more special purpose (and/or high priced) products will
always have things that PLplot lacks (or do them better). One way I see
to fit PLplot in the overall software environment is to add more output
drivers, both for generic file formats (e.g. GIF, CGM) as well as for
specific high-end graphics packages (e.g. AVS). That way you could
produce your graphics and view them using PLplot, dumping to disk those
pages or plots you want to process using a separate package. This can
already be done using the XFig driver, for example. For maximum
effectiveness of this scheme, PLplot should have internal knowlege of more
varied objects than "line" (currently the fundamental unit), and I have
some plans in this area.
I'm always interested in gaining new collaborators and contributors for
PLplot, so feel free to send me email ([email protected]) so we can
discuss additions you'd like to make. Want to help support PLplot but
need suggestions? I hesitate to recommend anything that will require
broad changes to the package, but any of the following would be great:
volunteers for target platform support (I have HPUX covered)
output drivers: GIF, CGM, others?
PLplot demos? (especially using Tcl/TK)
an improved contour plotter
any interesting ideas/code for TK widgets for use with PLplot
anything from the ToDo list you'd like to tackle?
help rewriting the manual? (OK, so I'm really reaching here)
+2.2 Could you comment on the pros and cons of plplot and gnuplot?
They came from a different set of objectives initially. PLplot started
out primarily as a library and gnuplot as an interactive tool. At one
time gnuplot acquired some library-like capabilities but these were never
merged back into the master sources, and are quite out of date by now (I
hear). PLplot is becoming more interactive. Eventually I think PLplot
will surpass gnuplot even for interactive plots for the following reasons:
(a) it will have full access to the underlying plot library, which is more
varied than gnuplot (with good support for contour, surface, 3d plots,
etc).
(b) the scripting language I use for it is Tcl (note: there are others
too, see questions 2.3, 2.4). Tcl has a large following and is fairly
well thought out, rather than a home-grown language.
(c) the most advanced driver is based on Tk, an X-windows tool kit, and
both (Tk and the PLplot capabilities based on it) are very powerful.
Unfortunately as it stands, (a) is not true yet, and the documentation
that describes all the current features is not done either. This will be
rectified by the time I release 5.0.
+2.3 How do I use PLplot to do interactive plotting?
> I am planning to use PLPLOT to plot some 2D pictures about software bug
> generation rate, bug correction rate, and etc. Using gnuplot I could put
> the X-Y data pairs in a file then use the 'plot' function. Is there a
> similar idiom in PLPLOT?
Such a thing is easily constructed in Tcl. I never bothered cooking up a
demo because it was too easy :-). But now I have one (~30 minutes of work,
modelled after elements of x01.tcl) -- it is included in the distribution
as examples/tcl/plot.tcl. To test it, type:
% pltcl
pltcl> source plot.tcl
pltcl> plot foo.dat
from the examples/tcl directory. As you can see, it is quite easy to use
Tcl for things like this and it's almost not worth it to construct huge
mega-commands like GNUPLOT's "plot" command, since the user can now write
Tcl procs to do exactly what is needed (i.e. without inventing a new API).
Therefore, I doubt I'll improve plot.tcl to be more like the GNUPLOT call,
although if someone does write such a beast and wants to share it, that's
great.
The main disadvantage of using pltcl for such things is that I don't often
use it, and am therefore slow to improve it. It needs more work on the 2-d
API (for contour, surface, and shade plots), better access to internal
variables, and so on.
Also, there are alternatives. Currently Ian Searle's RLaB and my pltcl are
the two best supported interpreter front-ends to PLplot. Radey Shouman
wrote a Scheme (SCM) interface which may appear publicly before long. John
Interrante wrote a python interface which I am integrating with the main
sources. And at one time there was a PLplot-based interpreter on the Amiga
that used Rexx as its script language (maybe OS/2 users would be interested
in this too, but unfortunately it's way out of date now).
+2.4 What is RLaB?
RLaB is an interpreted/interactive matrix programming language which
uses Plplot. RLaB has implemented most of the Plplot API so that users
can interactively visualize data. Additionally there is a higher level
abstraction of the Plplot capabilities that allows users to do things
like:
x = readm("mydata");
plot(x);
or
x = readm("mydata");
X = fft(x);
plaxis("log", "log");
plot(abs(X));
RLaB is geared towards scientific/engineering usage, but could also be
quite useful for other types of data.
RLaB is a "High Level Language" with matrices (2-d arrays) as a
fundamental object. Thus:
b = A*x;
where b is (Mx1), A is (MxN), x is (Nx1) works as expected. RLaB
includes a host of builtin linear-algebra, an spectral functions,
taking advantage of LAPACK, BLAS, and FFTPACK. Although RLaB may be
more than the original poster wants, I think it is at least worth a
mention.
+2.5 Why should I use Tcl?
> I've recently seen an article on the net (comp.lang.tcl:19017)
>
> Title: Why you should not use Tcl
> Author: Richard Stallman, GNU Project.
>
> In which a case was made to avoid a "scripting language" such as Tcl in
> favour of a language that is more easily extended.
> ...
> If indeed Richard Stallman knows what he is talking about, then is Tcl
> really the best way to extend PLplot?
(here I break from my usual convention and attribute responses)
Geoff's response:
Since you saw this post by RMS on c.l.t, I'm sure you also saw the
extremely severe flame fest which ensued. I think it would be good to
avoid repeating that on this channel, so let me refer interested
parties to the newsgroup for all the gory details. But since you are
clearly trying to probe what our thinking on these issues is, I will
provide at least a restrained response. Perhaps Maurice can do the same:
I have to say first that I have a great deal of personal respect for
the FSF and it's accomplishments, though I am less impressed by it's
stated aims. Nevertheless, I use GNU tools daily, especially but not
limited to GCC, and have even hacked GCC some myself. PLplot is now
distributed under the LGPL. etc.
However, in this case, the informed mind has to conclude, that Richard
Stallman spoke out of turn. It is most unfortunate that he used his
position of influence in the free software community to cast such a
spectre of FUD and inanity on Tcl/Tk. Certainly on technical merit,
his post was vacuous.
> Opinions on how PLplot should proceed?
I think Maurice and I are both squarely in the camp of:
"Let each man choose his own tools"
and we have chosen ours :-). If others want to go with Scheme (or
Python, or WINTERP, or whatever), that's fine by us, and we are
willing to help integrate and incorporate such user-contributed
modifications into the distribution. In point of fact, there already
is a Scheme port of PLplot, done by another fellow in Austin, and we
are working with him to increase the visibility of his work.
As for PLplot and Tcl/Tk. I do think there is an issue with Tcl
regarding the construction of large script systems. Tcl provides very
poor support for "large" software, whatever that means to a given
person. That is precisely why I recommend ALWAYS using the [incr Tcl]
extension, which provides to Tcl exactly the same sorts of things that
C++ provides to C. Not everyone is sold on object oriented
programming of course. Maurice, for instance, is still basically
comfortable with developing the PLplot library in C and writing the
Tcl parts of the Tcl/Tk and DP drivers in plain Tcl. I on the other
hand, write new code in C++ if at all possible rather than C, and in
[incr Tcl] rather than plain Tcl. Although it is not so easy for
all C users to switch to C++ (cost and availability of compilers being
the main issue here), it is clearly no big deal for people who use Tcl
to also use [incr Tcl] (since it is free, and just as portable as Tcl
itself). Maurice and I have been having a long standing dialogue
about whether to make [incr Tcl] a required addition to Tcl for
PLplot. Many parts of the PLplot Tk interaction could be provided in
a more robust, more customizeable, and most importantly more
extensible fashion if they were done in [incr Tcl]. Certainly all the
contributions I am making are being done in itcl, Maurice is still
making up his mind on that one.
In any event, there is certainly no reason why PLplot cannot be bound
to other scripting environments, and Maurice and I do not wish to
in any way discourage others from doing exactly that. The PLplot Tcl
bindings can serve as a point of reference for interested parties, and
so can the Scheme port.
The motto in our office is:
"Go wild!"
So if you've got an idea that involves something radically different
from Tcl/Tk/[incr Tcl], we say, "great, go wild!" Send us the diffs.
Maurice's response:
This post of RMS's inspired a truly awesome flamefest on the newsgroups
specified on the Followup-to: line, which were comp.lang.tcl,
gnu.misc.discuss, and comp.lang.scheme.
This whole thing would have been avoided if RMS had more net experience.
Those of us who have spent considerable time on the net know better than
to get on some language group and essentially say "your language sucks",
or to get on a computer group and say "your computer sucks". Usually,
there are many fine points involved which the poster, no matter how well
educated, simply doesn't have a clue. This is one of those cases.
Tcl is not the perfect extension language. I'm not sure that Scheme is
either. Does it matter? And Tcl *can* be improved further. E.g. Geoff
mentioned [incr tcl], an OO Tcl extension. I am currently flirting with
the idea of requiring it for the PLplot Tcl-TK part in some future
revision, after some reasonable period of supporting the old code. Since
[incr tcl] supports vanilla Tcl as well, the only real drawback is that
yet another package is required to be present, but this isn't that big a
deal.
Tcl is very popular and getting more so. It's easy to use and easily
embeddable in a C or C++ application. There is one book out on Tcl/TK
programming (JO's) and at least one more in the works. Plus it has
copious online documentation.
Finally, Tcl *has* been ported to non-Unix systems. Although it would
help if JO directly supported this effort. Looking at the new contrib
site (ftp.aud.alcatel.com) I see ports to MSDOS, the Mac, and VMS, and
I know of an old port to the Amiga as well.
This note just scratches the surface. Basically, I predict a bright
future for Tcl, and plan to use/support it with PLplot for a long time to
come.
+2.6 What are some of the planned enhancements to the PLplot interactive
capabilities?
By mirroring the C api in Tcl, it is becoming possible to rapidly
prototype data interaction programs, coded entirely as Tcl scripts,
generating PLplot output through Tcl commands. There are some demos of
this, but much much more can be done.
It would be really nice to have someone contribute Tcl code which went
farther in this direction. With a small amount of Tcl programming, it
is easy to imagine very powerful interactive data analysis
capabilities. Especially if these were provided as itcl classes, it
would then be possible to provide data analysis modules in Tcl/Plplot
which could then be "popped" into a code as easily as using the Tcl
autoload on demand mechanism.
Example itcl classes could be things like:
1-d histogram utility
reads data from specified file, puts up some
buttons to allow generation of histograms with
various different options
Financial analyst
reads data from a file, produces various sorts of bar
and pie charts.
Linear regression analyzer
reads data from a file, performs least square and
other forms of regression, calls histogram utility
(above) to generate graphs.
FFT analysis package
reaads 1 or 2 d data from a file, performs transforms,
plots spectral data in 1 or 2 d.
Volumetric data slicer
reads 2 or 3 d data from file, presents plshaded
contours with scale widgets for selection of cut
planes, isosurfaces, etc.
Functional calculator/explorer
provides entries for a mathematical expression, min
and max domain values, and plots the equation.
Provides buttons for performing integration,
(numerical) differentiation, fourier analysis (coupled
to the above mentioned package), spline fitting,
root finding, etc.
Some of these ideas will require the 2-d Tcl api, which is still being
worked on, but which is definitely coming. We (Maurice and I) cannot
hope to address all these issues ourselves, as we have other work to
do. We would very much like to see user contributed code in these
areas. I can provide direction to anyone who is interested enough to
seriously explore these issues. Basically I would recommend getting
itcl, and working through the "tkdemos", making sure you understand
the "embedded plframe" concept (discussed in the new chapter of the
manual), etc, as a great start. From there, the plan would be to
construct families of itcl classes embodying packages of widgets
(megawidgets in Tk parlance) which perform the above sorts of tasks,
or any others of your invention.
The potential is great, and the current demos only hint at what is
possible. We long to make PLplot the premiere scientific plotting and
data analysis package, but there is only so much work we can do in so
much time. There are tremendous opportunites for enterprising souls
to make great contributions in these areas. This would be fabulous
material for undergraduate semester projects in CS/math/engineering
computer-lab type classes, if there are any professors on this list
:-). Anyone who is interested in working in this sort of area is
welcome to contact me for further elaboration.
+2.7 Is there a PLplot newsgroup?
> I think one way to achieve better support/development of the PLPlot
> package would be to create a newsgroup to give such requests as the above
> a wider audience. Maybe something like comp.grahpics.PLPLOT?
>
> This could also be the place to ask questions like "How do I do this..."
> or "I have a problem doing this, can anyone help me?".
> Apart from that it could alleviate the pressure of supporting PLPlot by
> the primary developers (GF & MJL) so that they can spend more time
> actually doing new development.
A newsgroup comp.graphics.plplot would be fine with me. In fact, I've
long expected that one day it would happen. Unfortunately I know nothing
about starting a newsgroup, and also I'd want to relay it with the mailing
list, which again I know nothing about. I sort of wanted to get the 5.0
release off before that step, with the implied finishing of the
documentation :-). But sooner would be OK. If anyone wants to start the
ball rolling on this, let me know.
A positive note: as of May 1995 the mailing list has been converted to use
Majordomo, which is a significant enhancement. Users can now subscribe or
unsubscribe themselves (leaving me with more time for real work), see who
else is on the list, and retrieve the README, FAQ, and mailing list archive
by email. Just send the message 'help' (in the body of the message, not
the subject) to [email protected] for a full list of the
things you can do.
==============================================================================
Section 3: Specific features/capabilities
==============================================================================
3.1 The manual doesn't mention capability..
The manual is waaay out of date. Consult the last few update files to
keep tabs of what's going on. Take a look if there are are any
substantial new capabilities in the example programs. We went wild on the
manual a while back, rewriting it in LaTeXinfo so that we could publish it
in info file form. That info file is available in the doc directory, but
unfortunately (a) it still needs some polish and (b) it is still waaay out
of date. The next big push will see the end of it.
=3.2 How do I change the default background color?
Use the -bg option, or set by the plscolbg() API call.
In general it is safest to make all settings that may affect the driver (pen
width, color, etc) directly before the driver is initialized, i.e. before
calling plinit. It turns out that the Xwin driver has a firm concept of the
background color, and changing it on the fly isn't hard. Postscript (level
1), however, does not have the concept of background color. So to get a
specific background color, a rectangle covering the background must be drawn
and then filled using the appropriate color. Anything previously drawn is
obliterated. So clearly, changing the background color should at least have
no effect until the next bop, and in the 4.99i (and before) ps driver, only
the initial setting is honored. From 4.99j and later, the driver can get
the background color right on the next bop. Still, to get the correct color
starting from page 1 you need to set it before calling plinit, because
plinit does a bop.
Note that in 4.99i and before, the background color fill in the ps driver
was always done, independent of the color. This is unnecessary and even bad
in some cases, if the background is just white. E.g. when generating color
ps output as EPSF input to a document, a background fill causes the figure
to overwrite parts of the page that you probably want to keep.
3.3 I'm getting core dumps when calling a contour function from C.
Aha. Did you specify the minimum index as 1, not 0? This is a leftover
from when the package was written in Fortran, sigh. I'm not sure why this
isn't explained in the manual -- I just looked and there is no mention of
it. When I first got involved I mainly learned how to use the package
from the demo programs and so didn't really notice the inconsistency.
I've added some more explanatory error messages and will improve the
document in this area. Unfortunately it may be too late I think to change
the minimum index to 0, since by now many people are used to this way.
Maybe add some new function calls to fix up the API..
3.4 Changing the default line width doesn't have any effect.
Not all drivers support multiple line widths, in particular,
pixel-oriented ones such as all the Tek drivers. Further, it may not even
mean the same thing from driver to driver. If this ever becomes a serious
enough inconvenience I may take a harder look at it. One problem is that
display devices typically don't have the resolution for resolving the
difference between different line widths. For example, you can output
a plot using different line widths to a postscript file, and the lines
don't appear any visibly thicker until you hit 5 or so (so 1-4 look the
same, same for 5-8, and 9-10, or something like that). The only real
way to see the difference is to print it. Another problem is that there
may be no device support for multiple line widths. In this case you
can mock it up by drawing lines multiple times (very close together),
but this is a real pain.
The driver does initialize the width to something reasonable, but only
if the user hasn't already set it (i.e. it is zero). The postscript
driver uses a line width of 3 as a default, since this produces pretty
good results.
=3.5 How can I generate more than 16 line colors?
Two ways. 1. You can increase the number of colors in cmap0 with the -ncol0
option. 2. You can use cmap1 to do it, via plcol1(). Each color will be
interpolated along a piecewise linear curve in HLS space. This gives an
arbitrarily smooth color variation (for some drivers) with cmap1 index (in
range 0. to 1.).
3.6 What 2-d array organization am I supposed to use from C?
The 2d array organization has an interesting history. Back in plplot 2.6b
all the C API functions that took 2d arrays used column dominant
contiguous storage, while the corresponding Fortran API functions used row
dominant contiguous storage (naturally). The latter allocated temporary
arrays and performed a transpose before calling the C API. With plplot
3.0 Tony Richardson changed the C API to use arrays-of-arrays of pointers
to increase performance on some platforms. Unfortunately on high end
platforms (vector machines or superscalar RISC workstations) performance
can actually be worse as a result -- slowdowns due to memory access can be
much worse than doing extra computation.
As a result the situation re: 2d array organization in C became somewhat
confusing -- now there was a /third/ type of array organization, or /four/
if you want to count "normal" C array-of-pointers organization. So I
decided, years ago, that I wanted to have a general way of specifying
array organization to be used by the 2d function API, with front-end
routines used for converting from popular techniques. But as it isn't so
glamorous a pursuit, I've been slow to get it finished. :-\
The key idea is that for each major capability, there should exist a core
function that takes the array in a totally arbitrary way -- as a function
evaluator and its data. This can be used directly if desired -- for
example by a C++ user with his own matrix class. However I also will
provide front-end C API calls to handle the various popular 2d array
organizations. These front-ends merely pass in the appropriate function
evaluator to the core routine, passing the user's array as data. This
results in calls like plfcont(), which is the core routine, and plcont1(),
plcont2(), etc, which are the front-end routines.
The core routine can do one of two things: it can either use function
evaluations in place of the 2d array lookups in its computations, or
create a temporary array in some standard internal format for its
computations. Both have their merits. On low-end machines, the function
evaluator approach is better (since there is little loss of pipelining and
no temporary memory hit), while on high-end machines the reverse is true.
On the other hand, on high-end machines the odds are better that you are
spending most of the CPU time on things other than graphics, and
efficiency is less important. So I tend toward using the function
evaluator where it is convenient. In the contour plotter the function
acceses are clear and it was easy to substitute a function evaluator. In
plshade, however, the code is a bit too involved for this to be done
easily so instead I've gone the temporary array route. Either way, as
long as the API is put in place and documented, I can always go back and
change things around internally later on.
My intentions right now is to give this a good look very soon, so that
if I need to break the C API to make it more consistent, it happens
before I release 5.0.
3.7 On stretched windows, the string characters look bad..
> - If I make a window of say y=100 and x=1000 the character are rather
> stretched. Is there a way to avoid this.
I haven't had the need for it and am barely familiar with how to do it.
The best way to fix it won't happen until I support actual text by the
driver, which is a long ways off yet. But I think you can specify
physical dimensions of your output device using plspage(). In fact,
plspage() is called by the argument parser for the -geometry flag, but the
options specifying physical dimensions -- xpmm and ypmm -- aren't filled
in. I can put changing this on my todo list. But if it works, it will
only work as long as the window isn't resized.
Eventually, the driver and internal page representation will be
intelligent enough to support page resizing without changing the aspect
ratios of certain objects such as characters, strings, fixed aspect
viewports, etc. But like I said, it's a way off.
=3.8 I would like to capture key sequences..
> Also, I would like to be able to capture the PF2 and PF4 keys. My
> application consistently uses these keys for particular responses. If
> I can catch them, the application can take appropriate action.
You can catch these now from C by installing a keyboard event handler,
via the function:
/* Set the function pointer for the keyboard event handler */
void
plsKeyEH(void (*KeyEH) (PLGraphicsIn *, void *, int *), void *KeyEH_data);
You can look at the code in plrender as an example. It uses a keyboard
event handler in order to detect & act on page seeking commands. It would
be possible to mock something up for Fortran too if needed. There is no
problem with doing this from X since only a single key code is
transmitted, but an xterm sends an escape sequence. Your event handler
would be called for each key code which makes recognition a bit harder but
still doable (if in an xterm).
-3.9 How to get more information about a function or capability.
> I would like to be able to take advantage of the new routines that came
> with 4.99g, but to do this I need to know the argument list that is
> supplied to each one - the additional docs that came with 4.99g are very
> sketchy on this.
>
> I would particularly like to use plscmap1l, which I have had trouble
> with, also the following which are not explained:
>
> * plwarn plexit plcol0 plcol1 plrgb plrgb1 plscolbg plscol0 plgcol0
> * plscmap1 plscmap1f1 plscolor
>
> Any details would be gratefully received.
Well for me to really explain would be basically the same as finishing the
docs, which I don't have time for right now. I suggest looking at the
example programs and especially the source. Now, I know that might not
sound like fun, but some of the source code is a fairly easy read. Look
in "plplot.h" -- each function has a prototype that lists arguments and
has a one-line description. The description is usually an abbreviated
version of the comments written with the function itself.
If you are an emacs user, browsing the source code is very easy with
'tags'. From the tmp directory, type 'etags *.c'. Then edit plplot.h,
move the cursor to the name of the function you are interested in, and
type ESC-. <poof>, you are there. Happy hunting.
p.s. Some of the new capabilities are illustrated in C example programs
but not Fortran, e.g. see x15c and x16c. x17c isn't working yet.
+3.10 What are the keyboard controls in the graphics window?
> Can you give me a pointer as to the other keyboard controls that are
> in effect in such a window? Is it in the docs/sources?
> I've noticed that Q quits the window(?)
It depends on the driver to some extent. Here are the recognized keys
for the xwin and tk/dp drivers (tek is similar):
case PLK_Return:
case PLK_Linefeed:
case PLK_Next:
/* Advance to next page (i.e. terminate event loop) on a <eol> */
/* Check for both <CR> and <LF> for portability, also a <Page Down> */
case 'Q':
/* Terminate on a 'Q' (not 'q', since it's too easy to hit by mistake) */