I was using PlPlot (http://plplot.sourceforge.net) to do plotting on the
Mac before Mac OS X. When OS X came out, I started looking into writing a
shell to do plotting on the Mac under Quartz and Cocoa. When Aquaterm cam
out, I looked at using this as the front end. I used the PGPlot
interface and modified it for PlPlot. I am including all the required
files and instructions on how to compile PlPlot with the Aquaterm files.
The simplest way to compile and test out PlPlot is to run it as a command
line program. I created a Foundation tool project and place the PlPlot
source, header, examples and driver files into individual groups. You can
remove those driver files for other systems you don't need or you can
leave them in.
- Remove mac.c and mac.h files from the drivers and header files if they
are there. You can use those for a classic version.
- Place aqt.m, aqt.h, AQTProtocol.h where ever you want.
- Make sure Foundation and Appkit Frameworks are in the project. Add them
if they aren't there
- In the examples, I renamed "main(int argc, char *argv)" to
"pl_main(int argc, char *argv)" and use the included main.m file to call
the examples. This only required one global replace per example file and
simplified the whole process.
The following are additional mods to the core Plplot files needed set up
Plplot to use Aquaterm.
- in the file plDevs.h, add the line
#define PLD_aqt // Aquaterm Device
and undefine all the other devices. This informs PlPlot that all plotting
will take place via Aquaterm. I also tested the postscript driver and it
works - of course.
- In the file plcore.h, add the lines:
This identifies the dispatch table for Aquaterm plotting calls
- In the file drivers.h add the line
void plD_dispatch_init_aqt ( PLDispatchTable *pdt );
In the attached screen capture, PlPlot_PB.jpg, (See location below) I show
what files are
modified and how I set up the project builder sructure. I had a minor
problem with the way header files were included in the source files. The
source files had
#include "plplot/header.h" , I put all the files into one folder and did a
global replace on "plplot/header.h" to just "header.h"
The files in the lib folder that contain the Hersey fonts and map data
need to be either in the folder with the compiled image or you can set a
series of environment variables to tell PlPlot where to look for these
files. See plplotP.h and plLibOpen() in file plctrl.c for information on
the variables to set. If plplot can't find these files, it complains and
These files are: usaglobe.map; usa.map; plxtnd5.fnt; plstnd5.fnt;
With the above instructions, I was able to compile all the examples and
run them. Some required tcl and tk or other special features I haven't
gotten around to implement yet. All the c versions compiled with no mod's
except for the "main" -> "pl_main" change except there were problems with:
x14.c requires tcl and tk
x17.c It's a stripcchart, and partly works then it crashes - I'll
look into it
x20.c works with images and I need to better understand Aquaterm
interface to make it work
also, the tutor.c program requires a data file if you want to run that.
Screenshots for some of the examples are included at the following site:
PlPlot1.jpg Screen shot of plplot example
PlPlot2.jpg Screen shot of plplot example
PlPlot_PB.jpg Project Builder set-up
Couple of notes:
Other changes I made: I changed the plotting area in Aquaterm. You had
set the plotting window max's in the variables AQUA_XMAX and AQUA_YMAX and
also hard coded it in a couple of other places.
In GPTView.h, i changed the definitions of AQUA_XMAX and AQUA_YMAX to be
#define AQUA_XMAX (12.0*72.0) /* width times screen resolution.
12.0*72 = 864.0 */
#define AQUA_YMAX (12.0*72.0) /* height times screen resolution. 12.0*
72 = 864.0 */
Wherever you had hardwired the max sizes before, I included the header
file GPTView.h and replace them with AQUA_XMAX and AQUA_YMAX where
I also made the GPTView window in GPTWindow.nib a 400 x 400 viewing size
and set the max size to be 800 x 800 and min size to be 200 x 200. Others
might want something else, but, these work for me.
Whatever one sets AQUA_XMAX and AQUA_YMAX to in AquaTerm, make sure the
variables AQT_Max_X and AQT_Max_Y in aqt.m are set to the same value.
Number of Aquaterm plotting windows: This is controlled by the variable
currentPlot defined in aqt.m. In the routine: plD_bop_aqt, I set a
maximum numer of windows in the line:
currentPlot = currentPlot>maxWindows?0:currentPlot;
Change the value of maxWindows to whatever you want. It's set to 10 now.
When currentPlot exceed that number, it will start to reuse open windows.
As a result of going through this process, A couple of things would be nice:
- Ability of Aquaterm to return cursor position in the plotting area
- Ability to provide interactive feed back to and from the plotting
package and Aquaterm. Ths is nice because right now, I just let it run
between plots. I could set a simple "hit return" at the end of each plot
to inform plplot to do the next set.
- Ability to make Quicktime movies from a series of plots.
- Ability to copy the plot without it being a postscript file - Under the
classic version, when I copied a plot, I did it as a PICT so I could edit
the plot. It's tough editing a postscript file.
- Speed up Aquaterm plotting.
That's about it for now. Hopefully, this makes sense.