Gnuplot In Action - Uni-tuebingen.de

3y ago
38 Views
2 Downloads
7.75 MB
398 Pages
Last View : 4d ago
Last Download : 3m ago
Upload by : Genevieve Webb
Transcription

IN ACTIONUnderstanding data with graphsPhilipp K. JanertFOREWORDS BY COLIN D. KELLEYAND THOMAS WILLIAMSMANNING

Gnuplot in ActionLicensed to Lars Nilse lars.nilse@manchester.ac.uk

Licensed to Lars Nilse lars.nilse@manchester.ac.uk

Gnuplot in ActionUnderstanding Data with GraphsPHILIPP K. JANERTMANNINGGreenwich(74 w. long.)Licensed to Lars Nilse lars.nilse@manchester.ac.uk

For online information and ordering of this and other Manning books, please visitwww.manning.com. The publisher offers discounts on this book when ordered in quantity.For more information, please contactSpecial Sales DepartmentManning Publications Co.Sound View Court 3B fax: (609) 877-8256Greenwick, CT 06830 email: orders@manning.com 2010 by Manning Publications Co. All rights reserved.No part of this publication may be reproduced, stored in a retrieval system, or transmitted, inany form or by means electronic, mechanical, photocopying, or otherwise, without prior writtenpermission of the publisher.Many of the designations used by manufacturers and sellers to distinguish their products areclaimed as trademarks. Where those designations appear in the book, and ManningPublications was aware of a trademark claim, the designations have been printed in initial capsor all caps.Recognizing the importance of preserving what has been written, it is Manning’s policy to havethe books we publish printed on acid-free paper, and we exert our best efforts to that end.Recognizing also our responsibility to conserve the resources of our planet, Manning booksare printed on paper that is at least 15 percent recycled and processed without the use ofelemental chlorine.Manning Publications Co.Sound View Court 3BGreenwich, CT 06830Development editor:Copyeditor:Proofreader:Typesetter:Cover designer:Nermina Miller, Tom CirtinBenjamin BergKatie TennantDottie MarsicoMarija TudorISBN 978-1-933988-39-9Printed in the United States of America1 2 3 4 5 6 7 8 9 10 – MAL – 14 13 12 11 10 09Licensed to Lars Nilse lars.nilse@manchester.ac.uk

The purpose of computing is insight,not numbers.—R. W. HammingThe purpose of computing is insight,not pictures.—L. N. TrefethenLicensed to Lars Nilse lars.nilse@manchester.ac.uk

Licensed to Lars Nilse lars.nilse@manchester.ac.uk

brief contentsPART 1 BASICS .11 Prelude: Understanding data with gnuplot 32 Essential gnuplot 163 Working with data4 Practical matters2949PART 2 POLISHING .655 Doing it with style 676 Decorations7 All about axes90110PART 3 ADVANCED GNUPLOT .1318 Three-dimensional plots1339 Color 15210 Advanced plotting concepts11 Terminals in depth12 Macros, scripting, and batch operations175200viiLicensed to Lars Nilse lars.nilse@manchester.ac.uk 222

PART 4 GRAPHICAL ANALYSIS WITH GNUPLOT .24313 Fundamental graphical methods24514 Techniques of graphical analysis27315 Coda: Understanding data with graphsLicensed to Lars Nilse lars.nilse@manchester.ac.uk 301

contentsforeword xviiforeword xixpreface xxiacknowledgments xxiiiabout this book xxvPART1 BASICS .11Prelude: Understanding data with gnuplot1.1A busy weekend4Planning a marathon1.234 Determining the future6What is graphical analysis? 9Data analysis and visualization concepts 10 Why graphicalanalysis? 12 Limitations of graphical analysis 12 1.3What is gnuplot?Gnuplot isn’t GNU1.4Summary1313 Why gnuplot?14 Limitations15ixLicensed to Lars Nilse lars.nilse@manchester.ac.uk 15

xCONTENTS2Essential gnuplot2.116Simple plots16Invoking gnuplot and first plots 17 Plotting data from afile 20 Abbreviations and defaults 23 2.2Saving and exporting 24Saving and loading commandsOne-step export script 272.33SummaryManaging large data sets3030 Smoothing and summarizing dataPlotting unsorted data files3.32529Multiple data sets per file: indexlines: every 313.2Exporting graphs 28Working with data3.125Math with gnuplot32Records spanning multiple32Smoothing noisy data 3538Mathematical expressions 38 Built-in functions 38User-defined variables and functions 39 Complex numbers 3.4Data transformations41Simple data transformationsfunction 423.53.641Plotting functions and dataTricks and warningsLogarithmic plots Pseudocolumns and the column434444How do logarithmic plots work? 443.74SummaryPractical matters4.14.24749Managing optionsData files 5150Permissible formats and options4.3Strings5155Quotes 55 String operations 55 String applicationsCrazy example: plotting the Unix password file 58 4.4 Generating textual output 59The print command4059 The set table option60Licensed to Lars Nilse lars.nilse@manchester.ac.uk 57

xiCONTENTS4.5Interacting with gnuplot 61Getting help 61 Command history 61 Hot keys andmousing 62 Reading data interactively 63 4.6Summary64PART 2 POLISHING .655Doing it with style5.167Choosing plot styles68Inline style directives 68Global style directives 705.2Plot stylesTerminal capabilities 6970Core styles 71 Box styles 72 Styles with errorbars orranges 78 Filled styles 81 Other styles 84 5.3 Customizing styles85Custom line styles 86 Specifying colorWorked example: half-tone shading 87 5.46SummaryDecorations6.16.26.38990Quick start: minimal context for data 91Digression: locations on a graph 92Additional graph elements: decorations 94Common conventionsObjects 996.48794 The graph’s legend or keyArrows94 Text labels97100Turning the key on and off 101 Placement 101Layout 101 Explanations 102 Appearance 104Default settings 104 6.56.6 Worked example: features of a spectrum 104Overall appearance 106Size and aspect ratio6.77SummaryAll about axes7.1106 Borders and margins108109110Multiple axes111Terminology 111 Plotting with two coordinate systemsShould you do it? 113 Licensed to Lars Nilse lars.nilse@manchester.ac.uk 112

xiiCONTENTS7.27.3Selecting plot rangesTic marks 116115Major tic marks 116 Minor tic marks 117 Formatting thetic labels 118 Reading tic labels from file 122Grid and zero axes 123 7.47.5A worked example 123Special case: time series 124Turning numbers into names: months and weekdaysGeneral time series: the gory details 1277.6Summary124130PART 3 ADVANCED GNUPLOT .1318Three-dimensional plots8.18.2Basics 135Options for surface and contour plotsSurface plots8.3Contour lines139Coordinate axes and view point141Borders8.41429Color9.1136 View pointSummary146 Defining palettesSmooth surfaces149153153 The palette optionCreating colored graphs with palettes157 The colorboxUsing color for data representationCase studiesSummary162 154157158 Other ways to use161Some sample palettes165169A smoothly varying function9.5 152Thoughts on palette designWords of caution 1689.4148151The pm3d modecolor 1609.3143Matrix formatColor spaces: a refresher9.2136Plotting data from a file using splot 145Grid format8.5133169 A complex figure173Licensed to Lars Nilse lars.nilse@manchester.ac.uk 171

xiiiCONTENTS10Advanced plotting concepts10.1Multiplot175176Regular arrays of graphs with layout 177 Graphs within agraph 179 Graphs aligned on a common axis 181 10.2Higher math and special occasionsParametric plots 183Vector fields 18810.3183Non-Cartesian coordinates 184Curve fitting 190Background 190 Using the fit commandexample 195 Should you do it? 197 191Worked 10.411Summary199Terminals in depth11.111.2200Exporting graphs to file 201Common terminal options 202Size 202 Fonts 202 Enhanced text mode 202Miscellaneous appearance options 205 Flushing outputchannels 205 11.3Standard graphics file formatsBitmaps11.4206SVG Print-quality outputPostScript 209PDF 21711.512208209Using PostScript plots with LaTeXInteractive terminalswxt11.611.7 218x11219Other terminalsSummary 221220 206218 aqua219 windowsMacros, scripting, and batch operations12.112.2211219222Strings and string macros 223Calling other programs from gnuplot224Executing a command in a subshell 225 Capturing the output ofa subprocess 225 Input/output redirection (Unix only) 226Example: watermarking plots 227 12.3Calling gnuplot from other programs228Batch operations 228 Invoking gnuplot from otherprograms 229 Example: creating a font table 232 Licensed to Lars Nilse lars.nilse@manchester.ac.uk

xivCONTENTS12.412.5Slideshows with pause and reread 232Configuring your workspace 234Creating custom hot key bindings12.6Gnuplot for the web236239Using Gnuplot as a CGI script 239subprocess to a CGI script 24112.7Summary Using gnuplot as a241PART 4 GRAPHICAL ANALYSIS WITH GNUPLOT . 24313Fundamental graphical methods13.1RelationshipsScatter plots13.2245246246 Logarithmic scalesCounting statistics252256Jitter plots and histograms 256 Kernel density estimates 258Cumulative distribution functions 259 Consider using medianand percentiles 261 13.313.4Ranked data 262Multivariate data 264Parallel coordinate plots 264 Multivariate analysis 269Star plots 270 Historical perspective: computer-aided dataanalysis 271 13.514Summary272Techniques of graphical analysis14.114.2273The core principle of graphical analysisIteration and transformation 275274A case study in iteration: car data 275 Making datacomparable: monitoring quantities in a control chart 278the data: truncation and responsiveness 280 14.3Changing the appearance to improve perception Honor284Banking 284 Judging lengths and distances 287Enhancing quantitative perception 289 Plot ranges and thematter of zero 291 A tough problem: the display of changingcompositions 292 Licensed to Lars Nilse lars.nilse@manchester.ac.uk

xvCONTENTS14.4Housekeeping 296The lifecycle of a graphfiles 29814.514.615296 Input data filesReminders for presentation graphicsSummary 300Coda: Understanding data with graphsappendix Aappendix Bappendix C296298301Obtaining, building, and installing gnuplotGnuplot reference 309Resources 345index 351303Licensed to Lars Nilse lars.nilse@manchester.ac.uk Output

Licensed to Lars Nilse lars.nilse@manchester.ac.uk

forewordThomas Williams was a CS undergrad and I was an EE/CS undergrad at Villanova University. The EE department had just built a VLSI design lab and we were both immediately drawn to it. The campus had two existing computer labs, both depressing. Theywere crammed into dingy basements filled with rows of VT100 terminals and the acridsmell of burnt coffee. By contrast, the new VLSI lab was on the top floor of the engineering building in a room with high ceilings and plenty of light. Better still, it had abrand-new Pyramid minicomputer—right there in its own air conditioned room—that ran Unix. The lab had a dozen AED color displays and a huge HP plotter. Dr. Richard Perry ran the lab and was happy to let us hack away as much as we wanted.Together we got a UUCP link that dialed out nightly to Princeton. We got sendmailand a news reader running. After a few months, the administrators discovered that thephone bill had skyrocketed due to nightly long distance calls to New Jersey! But wehad Villanova on the Arpanet.I’d been taking classes in electromagnetism and signal processing and reallywanted to visualize the equations. Tom had a similar need to visualize differentialequations. There were no reasonable tools on campus to do so. At home I had anearly PC clone with a bootlegged copy of Lotus 123 that could graph data, but graphing a simple equation was a clumsy process to first fill a spreadsheet with data pointsand then plot them. And Lotus 123 was never going to work with the HP plotter orAED terminals we had right there. In the fall of 1986, I suggested to Tom that we writethe program we really wanted. He agreed. We settled on calling it gnuplot as a pun ona lame program at school that predated ours called “newplot.” It wasn’t until a monthxviiLicensed to Lars Nilse lars.nilse@manchester.ac.uk

xviiiFOREWORDlater that we read Richard Stallman’s Gnu Manifesto. That resonated with us andmatched our thinking perfectly. The common name was simply a lucky coincidence.Fortran and Pascal were the prevailing languages taught in school then, but neither was portable. C was clearly a better fit and Unix was the right OS to start with.Tom focused on writing the equation parser and P-code evaluator while I focused onthe command-line processor and graphics drivers. The command-line approach waspatterned after Vax/VMS and chosen out of necessity; there were no portable GUIsthen and, besides, we wanted to be able to use dumb terminals to drive the plottersand printers we had nearby. Within a month we had the basics working. After that westarted porting to every machine we could find with a C compiler: VMS, MS-DOS, andseveral flavors of Unix.By the fall of 1987, we published gnuplot as open source to newsgroups likesci.math. We were surprised by the response we got! Notes of thanks and encouragement came in from all around the world. More importantly, we received bug fixes andpatches to make gnuplot more portable to add support for many more terminals anddevices. We folded those in while adding features and fixing bugs ourselves.Tom and I both graduated in 1987 and didn’t look at gnuplot much after that. Butit took on a life of its own thanks to the dedicated contributions of others, and now it’stremendously more powerful than when we left it. People have continued to add features to it, and now there is this book, Gnuplot in Action, to serve as guide to all thatgnuplot has to offer. What a great testament to the benefits of open source!—COLIN D. KELLEYCTO, RingRevenue, Inc.Original Gnuplot AuthorLicensed to Lars Nilse lars.nilse@manchester.ac.uk

forewordI smiled when I learned that there would be a book about gnuplot. It had been a longtime since Colin and I were busy compiling new builds, which at the time needed tobe cut up into little “packages” to fit on the relatively new USENET. And a long timesince we heard from the early customers. To be honest, back then, we were pretty surprised at the actual volume of reactions and the diversity of uses people were findingfor it. It made us really happy to realize that universities, researchers, economists, hospitals, and various companies around the world were using it. For me, it was a bellwether for the future power of the Internet and open source software. I stillremember when the “University of Free Estonia” sent us an email just days before theBaltic States had officially announced their independence. And I remember trackingwhen we’d been deployed in every inhabited continent (with active websites in Czech,French, German, Indonesian, Japanese, Portuguese, Slovak, Italian, and more). Andnow this new book, Gnuplot in Action, is finally available to help those people startingout with gnuplot or those stepping up to do more complicated things!There are a few fundamental beliefs I’d like readers to understand about gnuplot.From the beginning, it had to be fun, with no learning curve to create your first fewplots. It had to be free and stay free. It had to be easily available and reliable. We wroteit to run on every type of computer, every display, every printer we could get ourhands on. But of course we didn’t have everything on hand and new devices launchedall the time. So there was a requirement for gnuplot to be modifiable, so that onegroup of users or developers could write new features simply and have the resultsxixLicensed to Lars Nilse lars.nilse@manchester.ac.uk

xxFOREWORDincluded in subsequent versions. Ultimately, gnuplot of today owes most of its successto the many volunteers who consistently contribute ideas and time to the development of the project. The result, hopefully, is a product powerful enough to creategraphs which convey exactly the information their authors intended.Enjoy!—THOMAS “THAW” WILLIAMSGoogleOriginal Gnuplot AuthorLicensed to Lars Nilse lars.nilse@manchester.ac.uk

prefaceI have been using gnuplot for 15 years, and it’s an indispensable part of my toolset:one of the handful of programs I can’t do without.Initially, I used gnuplot as part of my academic research work as a theoretical condensed matter physicist. But much later, when I joined Amazon.com, I found myselfusing gnuplot again, this time to analyze the movement of workers in Amazon’s gargantuan warehouses and the distribution of packages to customers. Later yet, I foundgnuplot helpful when analyzing web traffic patterns for the Walt Disney Company.I find gnuplot indispensable because it lets me see data, and do so in an easy,uncomplicated manner. Using gnuplot, I can draw and redraw graphs and look atdata in different ways. I can generate images of data sets containing millions of points,and I can script gnuplot to create graphs for me automatically.These things matter. In one of my assignments, I was able to discover highly relevant information because I was able to generate literally hundreds of graphs. Putting allof them on a web page next to each other revealed blatant similarities (and differences) between different data sets—a fact that had never before been noticed, notleast because everybody else was using tools (mostly Excel) that would only allowgraphs to be created one at a time.While at Amazon, I discovered something else: data is no longer confined to thescience lab. In a modern corporation, data is everywhere. Any reasonably sophisticatedorganization is constantly collecting data: sales numbers, web traffic, inventory, turnover, database performance, supply chain details, you name it. Naturally, there’s a continuous and ever-increasing demand to make use of this data to improve the business.xxiLicensed to Lars Nilse lars.nilse@manchester.ac.uk

xxiiPREFACEWhat this means is that data analysis is no longer a specialist’s job—everybody hasa need for it, even if only to monitor one’s own metrics or performance indicators.This isn’t a bad thing. The way inputs influence outputs is often not obvious, and placing decisions on a firmer, more rational footing is reasonable.But what I also found at Amazon and elsewhere is that the people doing the dataanalysis often don’t have the right toolset, both in terms of actual software tools and inregard to methods and techniques.In many ways, my experience in the corporate world has been an influence whilewriting this book. I believe that graphical methods—which are accessible to anyone,regardless of mathematical or statistical training—are an excellent way to understanddata and derive value from it (much better and more powerful than a five-day statisticsclass, and much more flexible and creative than a standard Six-Sigma program).And I believe that gnuplot is a very good tool to use for this purpose. Its learningcurve is flat—you can pick up the basics in an hour. It requires no programming skills.It handles a variety of input formats. It’s fast and it’s interactive. It’s mature. It’s alsofree and open source.Gnuplot has always been popular with scientists all over—I hope to convince youthat it can be useful to a much larger audience. Business analysts, operations managers, database and data warehouse administrators, programmers: anybody who wants tounderstand data with graphs.I’d like to show you how to do it.Licensed to Lars Nilse lars.nilse@manchester.ac.uk

acknowledgmentsSeveral data repositories on the web were helpful, either because of the data sets available there or merely as a source of inspiration. Among the most helpful were The data set collection and the Data and Story Library (DASL) at StatLib(http://lib.stat.cmu.edu)The UCI Machine Learning Repository at UC Irvine (http://www.ics.uci.edu/ mlearn/MLRepository.html)R. J. Hyndman’s Time Series Data Library (http://www-personal.buseco.monash.edu.au/ hyndman/TSDL)The Exploring Data site at Central Queensland University (http://exploringdata.cqu.edu.au)Wh

PostScript 209 Using PostScript plots with LaTeX 211 PDF 217 11.5 Interactive terminals 218 wxt 218 x11 219 aqua 219 windows 219 11.6 Other terminals 220 11.7 Summary 221 12 Macros, scripting, and batch operations 222 12.1 Strings and string macros 223 12.2 Calling other programs from gnuplot 224

Related Documents:

Blade Runner Classic Uncommon flooring - Common standards Solerunner Uni Solerunner Bladerunner Solerunner Uni Uni ICE Uni SKY Uni SAND Uni EARTH Uni NIGHT Uni POOL Uni MOSS Uni PINE Sky Sky UNI Sky STONE ENDURANCE VISION SPLASH Ice Ice UNI Ice STONE Ice ENDURANCE Ice SPL

display of scientific data. gnuplot is copyrighted, but freely distributable; you don’t have to pay for it. 1.2 How did it come about and why is it called gnuplot? The authors of gnuplot are: Thomas Williams, Colin Kelley, Russell Lang, Dave Kotz, Joh

Gnuplot supports many types of plots in either 2D and 3D. It can draw using lines, points, boxes, contours, vector elds, surfaces, and various associated text. It also supports various specialized plot types. Gnuplot supports many di erent types of output: interactive screen terminals (with mouse and hotkey

16247-1:2012 Requisiti generali UNI CEI EN 16247-2:2014 Edifici UNI CEI EN 16247-3:2014 Processi UNI CEI EN 16247-5 Qualificazione degli Energy Auditors (2015) UNI CEI EN 16247-4:2014 Trasporti UNI CEI EN 16247 9 . UNI CEI EN 1624

Unicondylar knee prostheses AMPLITUDE 22 1 4,5 Uni Score HA-Uni Score FB 2 hybrid 2 Uni Score HA-Uni Score HA 1 uncemented 1 Uni Score-Uni Score FB 19 1 5,3 cemented 18 1 5,6 reverse hybrid 1 ATRHROSURFACE 2 HemiCAP 1 cemented 1 PF Wave 1 cemented 1 BIOMET 54 Oxford-Oxford 1 cemented 1 Oxford-Oxford HA 47 cementless 45 reverse hybrid 2 Persona .

Using T E X Fonts in the Gnuplot Postscript Terminal Harald Harders, h.harders@tu-bs.de 2003-03-03 The Postscript terminal can embed Postscript Type1 fonts (with extensions .pfa and .pfb ) andrueTType fonts (extension .ttf ) 1 using the command set terminal postscript fontfile '' The fontfile option can be used multiple times.

Gnuplot is a freely available, command-driven graphical display tool for Unix. It compiles and works quite well on a number of Unix flavours as well as other operating systems. This library enables sending display requests to Gnuplot through simple f95 calls. I believe that the best w

https://www.certification-questions.com. A. There must be security group rules blocking traffic as AWS auto configures VPC routing tables B. Configure BGP communities in VPC such that all VPCs that need to communicate with eachother have same community defined C. Create routing tables in each VPC, add CIDR for all the other VPCs in the routing table pointing to AWS Transit Gateway D. There .