1Read also the USAGE file. 2 3Build and install: 4 5The Octave binding for PLplot is now automatically generated with swig. 6 7Simply use the normal cmake command to configure PLplot, then 8 9<build_tool> install 10 11to build PLplot including its Octave binding, and install PLplot including 12its Octave binding and associated Octave examples. 13 14N.B. <build_tool> is typically the make command, but CMake allows for 15many others. 16 17Automatic Testing: 18 19In the build tree anytime after the cmake command is executed with 20the -DBUILD_TEST=ON option execute 21 22<build_tool> help |grep octave 23 24to find all test targets associated with octave. Generally, those targets 25have names which remind what they do. So, e.g., test_octave_psc tests 26all our standard Octave examples using -dev psc and 27test_octave_xwin tests some special interactive Octave examples using 28-dev xwin. 29 30Hand Testing (these direction may be out of date because automatic testing is 31so convenient): 32 33'cd' to the directory bindings/octave within the build tree. 34 35Invoke octave, (the path is automatically set by the configured 36.octaverc file which exists in that directory). 37 38Load the octave binding of PLplot. 39 40plplot_stub; 41 42Check the plplot version by typing "plgver". You should get the same 43version that you have just compiled, not some other version that might 44be installed. 45 46There are several Octave demos, 'p1' up to 'p20'. Try them: 47 48octave> for i=[1:15 19:20]; feval(sprintf("p%d",i));kbhit;endfor;oneplot 49 50and a set of script files that emulate the well known x??c plplot demos. Try: 51 52octave> plplot_octave_demo 53 54Demo x14c might fail, if you have problems with tk. 55 56You can set some preferences in the file 'pldef.m' 57 58Don't worry if you see the following warning: 59 60 warning: empty matrix found in matrix list 61 62You can avoid it setting "empty_list_elements_ok = 1;" in your 63~/.octaverc Octave startup file (see below). This is being corrected 64in plplot_octave, meanwhile keep remembering me :-). 65 66Using: 67 68After testing, type "make install". The default path to installation 69is <installation prefix>/share/share/plplot_octave. If you don't like 70the default <installation prefix> which is /usr/local, reconfigure 71PLplot using your preferred -DCMAKE_INSTALL_PREFIX=<installation 72prefix> option for CMake. 73 74There are three paths that you can add to LOADPATH: 75 761-The *needed* path is <installation prefix>/share/plplot_octave// 772-The demos path is <installation prefix>/lib/plplotx.y.z/examples/octave// 783-The path to switch between PLplot and gnuplot is <installation prefix>/share/octave// 79 80Note: If you are using octave2.9 then LOADPATH is obsolete and you must 81use addpath instead. Note also that a trailing // no longer includes 82all subdirectories. You must explicitly add them. In particular you need 83the support subdirectory of plplot_octave. 84 85If you want to test the installation with the demos, call octave and 86set the LOADPATH as in 87 88LOADPATH ="<installation prefix>/lib/plplotx.y.z/examples/octave//:\ 89<installation prefix>/share/plplot_octave//:" 90 91You can now repeat the demos you already tried. Or just type 'p1'<CR>, 92'p2'<CR> ... my preferred test is "plot(sin(1:10),'-o')". As usual, 93'help command' gives you some help. 94 95For everyday usage, you must setup your LOADPATH to include the install 96path *before* the standard Octave LOADPATH. The best way of doing it 97is to use the file ~/.octaverc to set it up. Add the following line to 98it, using of course the real install prefix: 99 100LOADPATH="<installation prefix>/share/plplot_octave//:<other path>:<other path>"; 101 102You can use the standard Octave plot commands if in the LOADPATH a 103":" appears *before* the plplot_octave path, as in 104 105LOADPATH=":<installation prefix>/share/plplot_octave//:<other path>:<other path>"; 106 107You can use the command toggle_plplot_use to change between the two 108sets of commands, but for this you must set an additional path in LOADPATH. 109It must be set as: 110 111LOADPATH="<installation prefix>/share/plplot_octave//:<installation prefix>/share/octave//:" 112 113You are done. You can now use almost all the standard Octave plot 114commands plus a whole bunch of new ones. 115 116If you want to use another driver othen than the "xwin" one, which is 117the defaul, you must first open a new plot window using "figure", e.g. 118 119 figure(1,"tk") 120 p1 121 fig(2,"xwin") # fig() is an alias to figure() 122 p2 123 124To print or save a plot, use 125 save_fig("foo.ps") 126 save_fig("|lp","ps") 127 128Use `lp_setup' to setup your printer. 129 130If you just want to use the PLplot API, use it as you would from a C 131program, with the exception that you don't need to specify matrices 132dimensions; e.g., for plline(n,x,y) you just need to call it as 133plline(x,y), where x and y are column vectors. Look at the various 134x??c.m examples in the demos directory. 135 136You can't call API functions whose arguments are pointers to 137functions. Some wrappers for common situations are however available. 138 139What you get: 140 141You have a 'demo' directory, with the equivalent octave script files 142x??c.m of PLplot C demos, and some new demos, p??.m. 143 144You have a 'PLplot' directory with modified versions of the standard 145octave plot command, plus a lot of new ones ready for Octave usage. You 146must have it on your LOADPATH before the standard octave/gnuplot plot 147scripts. If you install it in the default directory, use the octave 148command `octave_plplot_path' to setup the path. You can change between 149the default gnuplot plotter and octave_plplot using the octave command 150`use_plplot'. 151 152You have a misc directory with some other octave demos/utilities. 153 154You have an etc directory where the "documentation" is (not anymore, 155documentation is built from the main documentation file, api.xml. 156 157You have the directory where the README, INSTALL, PROBLEMS, 158BUGS, ToDo, are, plus 'plplot_octave_org.h', etc. 159 160As with every program, except D. Knuth ones, the programs in this 161package are not finished nor bug free. Please report bugs and send 162patches. I will not send checks for each bug discovered :-) 163 164Enjoy, 165 166Joao 167 168Update for octave 2.9 by Andrew Ross. 169Update for CMake by Alan W. Irwin. 170