Ruby/PGPLOT
Version 0.1.6 by Masahiro TANAKA 2012-02-18
Description
-
Ruby interface to PGPLOT. It provides PGPLOT functions as a Ruby module.
Requirements
-
Libraries which PGPLOT drivers use:
-
X11 library
-
PNG library
-
-
Ruby version 1.8.x/1.9.x/2.0.x
-
NArray version 0.5.x/0.6.x
Installation
-
Install PGPLOT library
-
FORTRAN77 compiler required for source-compile.
-
C interface library (libcpgplot.a) is also required.
-
On Ubuntu, the required PGPLOT files can be installed via this command:
$ sudo apt-get install pgplot5
-
-
Install Ruby, NArray
-
Install Ruby/PGPLOT
-
To install via RubyGems (recommended!):
$ sudo gem install pgplot
-
To install manually:
-
extract distribution.
-
compile and install by:
$ ruby extconf.rb [ (see below)] $ make $ make site-install (or make install)
-
Options for ‘ruby extconf.rb’:
--with-pgplot-include=path : path to cpgplot.h --with-pgplot-lib=path : path to PGPLOT libraries. --with-grwin : for using GrWin (cygwin/mingw).
example:
ruby extconf.rb \ --with-pgplot-include=/usr/local/pgplot \ --with-pgplot-lib=/usr/local/pgplot
-
-
Usage
-
Environment variables for PGPLOT (csh)
setenv PGPLOT_DIR /usr/local/lib/pgplot/ # pgxwin_server, rgb.txt setenv PGPLOT_FONT ${PGPLOT_DIR}/grfont.dat setenv PGPLOT_DEV /xwin
-
To load the Ruby/PGPLOT extension;
require "pgplot"
-
Module name is ‘Pgplot’. If you want to omit the module name;
include Pgplot
-
Pgplot module method names are lower case of corresponding PGPLOT functions. To start plotting:
pgbeg('/xwin')
See PGPLOT manual for function usage. Arguments are not always same as the FORTRAN PGPLOT. FuncUsage file includes a list of functions with different arguments.
Platforms tested
-
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]
-
ruby 1.8.7 (2011-02-18 patchlevel 334) [x86_64-linux]
-
NArray 0.6.0.1
-
gcc/gfortran version 4.5.1 20100924 (Red Hat 4.5.1-4) (GCC)
License
This program is free software.
You can distribute/modify this program
under the same terms as Ruby itself.
NO WARRANTY.
Acknowledgment
M.T. thanks to Tim Pearson for developing the useful PGPLOT library
and giving me the to distribute the Ruby version of pgdemos.
M.T. also thanks to the developers of the Ruby language
for providing the wonderful language.