The GNU Plotting Utilities Programs and Functions for Vector Graphics and Data Plotting Version 2.4.1
Total Page:16
File Type:pdf, Size:1020Kb
The GNU Plotting Utilities Programs and functions for vector graphics and data plotting Version 2.4.1 Robert S. Maier and Nicholas B. Tufillaro Copyright c 1989–2000 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copy- right notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the condi- tions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the Foundation. i Short Contents 1 The GNU Plotting Utilities ..................................... 1 2 The graph Application ........................................ 4 3 The plot Program .......................................... 26 4 The pic2plot Program ....................................... 34 5 The tek2plot Program ....................................... 42 6 The plotfont Utility ........................................ 49 7 The spline Program ........................................ 56 8 The ode Program ........................................... 62 9 libplot, a 2-D Vector Graphics Library ........................... 78 A Fonts, Strings, and Symbols ................................... 125 B Specifying Colors by Name.................................... 145 C Page Sizes and Viewport Sizes ................................. 146 D The Graphics Metafile Format ................................. 148 E Obtaining Auxiliary Software .................................. 150 History and Acknowledgements .................................... 151 Reporting Bugs .............................................. 152 ii Table of Contents 1 The GNU Plotting Utilities ............................. 1 2 The graph Application .................................. 4 2.1 Simple examples using graph ................................................... 4 2.2 Non-square, displaced, and rotated plots ........................................ 8 2.3 Preparing a plot from more than one dataset .................................... 9 2.4 Multiplotting: placing multiple plots on a single page ........................... 10 2.5 Reading binary and other data formats ........................................ 11 2.6 graph command-line options .................................................. 12 2.6.1 Plot options ............................................................. 13 2.6.2 Dataset options .......................................................... 19 2.6.3 Multiplot options ........................................................ 22 2.6.4 Raw graph options....................................................... 22 2.6.5 Informational options .................................................... 22 2.7 Environment variables ........................................................ 23 3 The plot Program..................................... 26 3.1 How to use plot ............................................................. 26 3.2 plot command-line options ................................................... 27 3.3 Environment variables ........................................................ 32 4 The pic2plot Program ................................. 34 4.1 What pic2plot is used for .................................................... 34 4.2 pic2plot command-line options ............................................... 35 4.3 Environment variables ........................................................ 39 5 The tek2plot Program ................................. 42 5.1 What tek2plot is used for .................................................... 42 5.2 tek2plot command-line options ............................................... 42 5.3 Environment variables ........................................................ 46 6 The plotfont Utility ................................... 49 6.1 How to use plotfont ......................................................... 49 6.2 plotfont command-line options ............................................... 50 6.3 Environment variables ........................................................ 54 7 The spline Program ................................... 56 7.1 How to use spline ........................................................... 56 7.2 Advanced use of spline ...................................................... 57 7.3 spline command-line options ................................................. 59 iii 8 The ode Program...................................... 62 8.1 Mathematical basics .......................................................... 62 8.2 Simple examples using ode .................................................... 63 8.3 Additional examples using ode ................................................ 66 8.4 ode command-line options .................................................... 68 8.5 Diagnostic messages .......................................................... 70 8.6 Numerical error and how to avoid it ........................................... 71 8.7 Running time ................................................................ 74 8.8 The ode input language formally specified ...................................... 74 8.9 Bibliography on ode and solving differential equations ........................... 77 9 libplot, a 2-D Vector Graphics Library ................. 78 9.1 Programming with libplot: An overview ...................................... 78 9.2 C Programming with libplot ................................................. 81 9.2.1 The C application programming interface .................................. 81 9.2.2 Older C application programming interfaces................................ 82 9.2.3 C compiling and linking .................................................. 83 9.2.4 Sample drawings in C .................................................... 84 9.2.5 Simple paths and compound paths ........................................ 88 9.2.6 Drawing on a physical page ............................................... 90 9.2.7 Animated GIFs in C ..................................................... 92 9.2.8 X Window System animations in C........................................ 94 9.2.9 Advanced X Window System programming ................................ 97 9.3 C++ Programming with libplotter .......................................... 100 9.3.1 The Plotter class ...................................................... 100 9.3.2 C++ compiling and linking ............................................... 101 9.3.3 Sample drawings in C++ ................................................. 102 9.4 The functions in libplot: A detailed listing................................... 103 9.4.1 Control functions ....................................................... 103 9.4.2 Object-drawing functions ................................................ 106 9.4.3 Attribute-setting functions .............................................. 110 9.4.4 Mapping functions ...................................................... 117 9.5 Plotter parameters .......................................................... 118 Appendix A Fonts, Strings, and Symbols................ 125 A.1 Available text fonts ......................................................... 125 A.2 Cyrillic and Japanese fonts .................................................. 130 A.3 Available text fonts for the X Window System ................................ 131 A.4 Text string format and escape sequences ...................................... 132 A.5 Available marker symbols ................................................... 142 Appendix B Specifying Colors by Name ................ 145 Appendix C Page Sizes and Viewport Sizes ............. 146 Appendix D The Graphics Metafile Format ............. 148 Appendix E Obtaining Auxiliary Software .............. 150 E.1 How to get idraw ........................................................... 150 E.2 How to get xfig ............................................................ 150 iv History and Acknowledgements .......................... 151 Reporting Bugs ......................................... 152 Chapter 1: The GNU Plotting Utilities 1 1 The GNU Plotting Utilities The GNU plotting utilities consist of eight command-line programs: the graphics programs graph, plot, pic2plot, tek2plot, and plotfont, and the mathematical programs spline, ode, and double. Distributed with these programs is GNU libplot, the library on which the graphics programs are based. GNU libplot is a function library for device-independent two- dimensional vector graphics, including vector graphics animations under the X Window System. It has bindings for both C and C++. The graphics programs and GNU libplot can export vector graphics in the following formats. X If this output option is selected, there is no output file. Output is directed to a popped-up window on an X Window System display. PNG This is “portable network graphics” format, which is increasingly popular on the Web. Unlike GIF format, it is unencumbered by patents. Files in PNG format may be viewed or edited with many applications, such as the free image display application xv and the free ImageMagick package. PNM This is “portable anymap” format. There are three types of portable anymap: PBM (portable bitmap, for monochrome images), PGM (portable graymap), and PPM (portable