The Plplot Plotting Library
Total Page:16
File Type:pdf, Size:1020Kb
The PLplot Plotting Library Programmer’s Reference Manual Maurice J. LeBrun Geoff Furnish University of Texas at Austin Institute for Fusion Studies The PLplot Plotting Library: Programmer’s Reference Manual by Maurice J. LeBrun and Geoff Furnish Copyright ľ 1994 Geoffrey Furnish, Maurice LeBrun Copyright ľ 1999, 2000, 2001, 2002, 2003, 2004 Alan W. Irwin, Rafael Laboissière Copyright ľ 2003 Joao Cardoso Redistribution and use in source (XML DocBook) and “compiled” forms (HTML, PDF, PostScript, DVI, TeXinfo and so forth) with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code (XML DocBook) must retain the above copyright notice, this list of conditions and the following disclaimer as the first lines of this file unmodified. 2. Redistributions in compiled form (transformed to other DTDs, converted to HTML, PDF, PostScript, and other formats) must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Important: THIS DOCUMENTATION IS PROVIDED BY THE PLPLOT PROJECT “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PLPLOT PROJECT BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Release version: 5.3.1 Release date: 2004-06-25 Table of Contents I. Introduction ..................................................................................................................xi 1. Introduction ............................................................................................................................... 1 The PLplot Plotting Library................................................................................................. 1 Getting a Copy of the PLplot Package.................................................................................. 2 Installing and Using the PLplot Library ............................................................................... 2 Organization of this Manual.................................................................................................. 2 Copyrights ............................................................................................................................. 3 Additional Copyrights................................................................................................... 3 Credits................................................................................................................................... 4 II. Programming................................................................................................................ 1 2. Simple Use of PLplot ................................................................................................................. 3 Plotting a Simple Graph ....................................................................................................... 3 Initializing PLplot ................................................................................................................. 3 Defining Plot Scales and Axes............................................................................................... 3 Labeling the Graph ............................................................................................................... 4 Drawing the Graph................................................................................................................ 5 Drawing Points ............................................................................................................. 5 Drawing Lines or Curves .............................................................................................. 5 Writing Text on a Graph.............................................................................................. 6 Area Fills ...................................................................................................................... 6 More Complex Graphs.................................................................................................. 7 Finishing Up.......................................................................................................................... 7 In Case of Error..................................................................................................................... 7 3. Advanced Use of PLplot ............................................................................................................ 9 Command Line Arguments.................................................................................................... 9 Output Devices...................................................................................................................... 9 Driver Functions ......................................................................................................... 11 PLplot Metafiles and Plrender.................................................................................... 11 Family File Output..................................................................................................... 14 Interactive Output Devices......................................................................................... 15 Specifying the Output Device..................................................................................... 15 Adding FreeType Library Support to Bitmap Drivers ........................................................ 17 Write a call back function to plot a single pixel ......................................................... 17 Initialise FreeType ...................................................................................................... 17 Add Function Prototypes............................................................................................ 19 Add Closing functions................................................................................................. 19 View Surfaces, (Sub-)Pages, Viewports and Windows ........................................................ 20 Defining the Viewport ................................................................................................ 20 Defining the Window .................................................................................................. 21 Annotating the Viewport............................................................................................ 22 Setting up a Standard Window .................................................................................. 22 Setting Line Attributes........................................................................................................ 23 Setting the Area Fill Pattern .............................................................................................. 23 Setting Color ....................................................................................................................... 24 Color Map0................................................................................................................. 24 Color Map1................................................................................................................. 24 Setting Character and Symbol Attributes........................................................................... 27 Escape Sequences in Text.................................................................................................... 28 Three Dimensional Surface Plots ........................................................................................ 29 iii Contour and Shade Plots .................................................................................................... 30 Contour Plots from C ................................................................................................. 30 Shade Plots from C..................................................................................................... 31 Contour Plots from Fortran........................................................................................ 31 Shade Plots from Fortran ........................................................................................... 32 4. Deploying programs that use PLplot ....................................................................................... 33 5. The PLplot X Driver Family.................................................................................................... 37 The Xwin Driver ................................................................................................................. 37 The Tk Driver ..................................................................................................................... 37 6. The PLplot Output Driver Family........................................................................................... 39 The Postscript Driver.......................................................................................................... 39 III. Language Bindings ...................................................................................................