Download the latest plplot release source: http://sourceforge.net/projects/plplot/files/plplot/
E.g. http://sourceforge.net/projects/plplot/files/plplot/5.9.5%20Source/plplot-5.9.5.tar.gz/download

Untar the plplot package:
tar -xzf plplot-x.y.z.tgz

Use cmake to install PLplot. This step will generate (among other things) usable headers that we will copy in QSAS.
cd plplot-x.y.z
mkdir build_dir
cd build_dir
cmake -DENABLE_f77=OFF -DENABLE_f95=OFF -DDEFAULT_NO_DEVICES=ON -DCMAKE_INSTALL_PREFIX=/Applications/plplot -DCMAKE_VERBOSE_MAKEFILE=ON ../
make 
make install

Copy the following from plplot-x.y.z (source folder) to QSAS/src/Utilities/qplplot/ using...

cp src/mt19937ar.c src/mt19937ar.h src/pdfutils.c src/plargs.c src/plbox.c src/plbuf.c src/plcont.c src/plcore.c src/plctrl.c src/plcvt.c src/pldeprecated.c src/pldtik.c src/plfill.c src/plfreetype.c src/plgridd.c src/plhist.c src/plimage.c src/plline.c src/plmap.c src/plot3d.c src/plpage.c src/plsdef.c src/plshade.c src/plstdio.c src/plstripc.c src/plsym.c src/pltick.c src/pltime.c src/plvect.c src/plvpor.c lib/csa/csa.c lib/csa/csadll.h lib/csa/csa.h lib/csa/nan.h lib/qsastime/qsastime.c lib/qsastime/qsastimedll.h lib/qsastime/qsastime_extra.c lib/qsastime/qsastime_extra.h lib/qsastime/qsastime.h build_dir/lib/qsastime/qsastimeP.h build_dir/lib/qsastime/tai-utc.h /Applications/QSAS_2_4/QSAS_dist/src/Utilities/qplplot

cp /Applications/plplot/include/plplot/* /Applications/QSAS_2_4/QSAS_dist/src/Utilities/qplplot
some headers may be missing from here.

Need to migrate to using their qt driver at stable release?

In /Applications/QSAS_2_4/QSAS_dist/src/Utilities/qplplot/:

Edit plConfig.h:

add:
#ifndef BUILD_DIR
#define BUILD_DIR getenv("QSAS_HOME")
#endif
#define VERSION_ "5.96"
// #define PL_HAVE_SNPRINTF 0 ?not needed any more ?
#define PL_DEFAULT_CMAP0_FILE "cmap0_default.pal"
#define PL_DEFAULT_CMAP1_FILE "cmap1_default.pal"
#define SOURCE_DIR ""
#define  PL_HAVE_MKSTEMP 1

Edit plgridd.c:

Change paths in includes:
#ifdef WITH_CSA
#include "csa.h"
#endif
#include "nan.h" /* this is handy */

edit plargs.c:
change "VERSION" for "VERSION_", to avoid conflicting macros

edit plcore.c:
change "VERSION" for "VERSION_", to avoid conflicting macros

edit plcore.h:
add...
#if defined ( PLD_qt ) && !defined ( ENABLE_DYNDRIVERS )
    plD_dispatch_init_qt,
#endif

edit plDevs.h:
add #define PLD_qt

edit drivers.h:
add PLDLLIMPEXP_DRIVER void plD_dispatch_init_qt  ( PLDispatchTable *pdt );

edit plstrm.h:
add in PLStream structure: 
	void * qtdev; 

edit plbox.c:

Modify this in 2 places.

        if ( !lly && !ldy && !loy && ymode )
        {
            snprintf( string, STRING_LEN, "(x10#u%d#d)", (int) yscale );
            if ( plsc->label_data )
            {
                height = ( (PLLabelDefaults *) plsc->label_data )->exp_label_disp;
                pos    = ( (PLLabelDefaults *) plsc->label_data )->exp_label_pos;
                just   = ( (PLLabelDefaults *) plsc->label_data )->exp_label_just;
		plmtex( "t", height, pos, just, string ); //  <<<<---- add this line

Also modify grid_box in plbox.c

    ldx = plP_stsearch( xopt, 'd' ); // AJA added for Fix

    lgy = plP_stsearch( yopt, 'g' );
    lhy = plP_stsearch( yopt, 'h' );
    lly = plP_stsearch( yopt, 'l' );

    plP_xgvpw( &vpwxmin, &vpwxmax, &vpwymin, &vpwymax );
// n.b. large change; vpwxmi always numerically less than vpwxma, and
// similarly for vpwymi
    vpwxmi = ( vpwxmax > vpwxmin ) ? vpwxmin : vpwxmax;
    vpwxma = ( vpwxmax > vpwxmin ) ? vpwxmax : vpwxmin;
    vpwymi = ( vpwymax > vpwymin ) ? vpwymin : vpwymax;
    vpwyma = ( vpwymax > vpwymin ) ? vpwymax : vpwymin;

// Draw grid in x direction.

    if ( lgx )
    {
	// AJA Fix
		if ( ldx )
		{
			pldtfac( vpwxmi, vpwxma, &factor, &tstart );
			tn = xtick1 * ( floor( ( vpwxmi - tstart ) / xtick1 ) ) + tstart;
		}
		else 
			tn = xtick1 * floor( vpwxmi / xtick1 );
			
        for ( ; tn <= vpwxma; tn += xtick1 ) // end AJA fix


in qsastimeP.h modify to read
#define QSASTIME_static


Fixes to Hershey Codes from SJS.

As before, the fix involves changing entries in plhershey-unicode.h:

Hershey numbers    plplot5.9.7 unicode      change to this
46, 546                  0x03d2                  0x03a5     Upsilon
634                      0x03d1                  0x03b8     theta
98, 684, 2184            0x03f5                  0x03b5     epsilon
686, 2186                0x03d5                  0x03c6     phi variant


850			 0x2219			 0x2022	    bullet

Note - You can use the gucharmap application to see all the unicode symbols,
and a whole lot more.
